Point package.json:bin at cli.js

This commit is contained in:
Brian Beck 2017-05-15 21:28:54 -07:00
parent fd86710fdb
commit f6ca61233c
3 changed files with 8 additions and 2 deletions

1
cli.js Normal file
View file

@ -0,0 +1 @@
require('./lib/index').start()

View file

@ -3,10 +3,11 @@
"version": "5.1.3", "version": "5.1.3",
"description": "An Express server and middleware for querying the MusicBrainz API using GraphQL.", "description": "An Express server and middleware for querying the MusicBrainz API using GraphQL.",
"main": "lib/index.js", "main": "lib/index.js",
"bin": "lib/index.js", "bin": "cli.js",
"files": [ "files": [
"lib", "lib",
"scripts", "scripts",
"cli.js",
"Procfile", "Procfile",
"schema.json", "schema.json",
"yarn.lock" "yarn.lock"

View file

@ -31,7 +31,7 @@ const middleware = ({
export default middleware export default middleware
if (require.main === module) { export function start () {
require('dotenv').config({ silent: true }) require('dotenv').config({ silent: true })
const app = express() const app = express()
const port = process.env.PORT || 3000 const port = process.env.PORT || 3000
@ -41,3 +41,7 @@ if (require.main === module) {
app.listen(port) app.listen(port)
console.log(`Listening on port ${port}.`) console.log(`Listening on port ${port}.`)
} }
if (require.main === module) {
start()
}