Added a fix script to the API.

This commit is contained in:
Jayden Seric 2017-11-08 14:57:36 +11:00
parent dcbcfaa0b2
commit e38833bbc0
3 changed files with 14 additions and 8 deletions

View File

@ -29,6 +29,7 @@
}, },
"scripts": { "scripts": {
"lint": "eslint . --ext mjs", "lint": "eslint . --ext mjs",
"fix": "npm run lint -- --fix && prettier --write readme.md",
"dev": "nodemon --ext mjs", "dev": "nodemon --ext mjs",
"start": "node --require @std/esm --require dotenv/config server.mjs" "start": "node --require @std/esm --require dotenv/config server.mjs"
}, },

View File

@ -4,21 +4,25 @@
An example GraphQL API using: An example GraphQL API using:
- [koa](https://www.npmjs.com/package/koa) * [koa](https://www.npmjs.com/package/koa)
- [graphql-server-koa](https://www.npmjs.com/package/graphql-server-koa) * [graphql-server-koa](https://www.npmjs.com/package/graphql-server-koa)
- [apollo-upload-server](https://www.npmjs.com/package/apollo-upload-server) * [apollo-upload-server](https://www.npmjs.com/package/apollo-upload-server)
## Setup ## Setup
1. Install the latest [Node.js](https://nodejs.org) and [npm](https://npmjs.com). 1. Install the latest [Node.js](https://nodejs.org) and
[npm](https://npmjs.com).
2. Duplicate `.env.example` as `.env` and customize. 2. Duplicate `.env.example` as `.env` and customize.
3. With Terminal in the `api` directory run `npm install`. 3. With Terminal in the `api` directory run `npm install`.
4. Run `npm run dev` for development, or `npm run start` for production. 4. Run `npm run dev` for development, or `npm run start` for production.
Ensure your editor supports: Ensure your editor supports:
- [EditorConfig](http://editorconfig.org). * [EditorConfig](http://editorconfig.org).
- [ESLint](http://eslint.org), respecting `package.json` config. [Atom](https://atom.io) users install [`linter-eslint`](https://atom.io/packages/linter-eslint) and enable `Fix errors on save`. * [ESLint](http://eslint.org), respecting `package.json` config.
[Atom](https://atom.io) users install
[`linter-eslint`](https://atom.io/packages/linter-eslint) and enable `Fix
errors on save`.
## Support ## Support

View File

@ -36,7 +36,8 @@ server.listen(process.env.PORT, error => {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.info( console.info(
`Serving at http://localhost:${process.env.PORT} in ${process.env `Serving at http://localhost:${process.env.PORT} in ${
.NODE_ENV} mode.` process.env.NODE_ENV
} mode.`
) )
}) })