node-api-starter

1.0.2 • Public • Published

Babel 7 Node API Starter base

  • Babel 7 so you can use all the babel goodness you want on your server
  • Nodemon for your development reloading bliss
  • Morgan for your logging needs
  • Helmet to help secure your application
  • Jest for testing & coverage
  • Prettier and ESLint for formatting and linting
  • Husky for git hooks

Running your API

  • npm start and start coding
  • Save your files and the server will automatically reload

Running your tests

Unit Tests

  • npm test
  • See Jest docs for how to write your tests
  • See /src/main/controller.test.js for an example of a test

Coverage

npm run coverage

Deploying your API

  1. npm run build to create a build of your code
  2. npm run serve to serve the code up from your /build directory

Logs

  • Logs use morgan for formatting the messages
  • All logs will be output into the /logs directory
  • Rotation policy on both app.log and error.log is 10Mb and/or 1 day
  • 4xx & 5xx errors will be placed into your error.log
  • All traffic will be recorded in app.log

Configuring logs

  • /src/express/logs.js contains the logging setup
  • You can add a new rotation policy (see rotating-file-stream for options)
  • You can also add another express middleware for writing new/different logs

Routing

  • Any routes.js file within the /src directory will automatically be picked up on application load
  • See /src/main/routes.js for an example

Readme

Keywords

Package Sidebar

Install

npm i node-api-starter

Weekly Downloads

11

Version

1.0.2

License

MIT

Unpacked Size

8.76 kB

Total Files

13

Last publish

Collaborators

  • wambotron