diff --git a/README.md b/README.md index b185920..82f99e5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![made with lad](https://img.shields.io/badge/made_with-lad-95CC28.svg)](https://lad.js.org) -> An API for Bree. +> An API for [Bree][]. ## Table of Contents @@ -41,7 +41,7 @@ The API will start automatically when the Bree constructor is called. | Option | Type | Description | |:------:|:------:|----------------------------------------------------------------------------------------------| -| port | Number | The port the API will listen on. | +| port | Number | The port the API will listen on. Default: `62893` | | jwt | Object | Configurations for JWT. Only option is `secret` which will be the secret used to verify JWT. | ## API @@ -56,3 +56,9 @@ Check out the [API Docs](https://documenter.getpostman.com/view/17142435/TzzDLbN [MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/) ## + +[npm]: https://www.npmjs.com/ + +[yarn]: https://yarnpkg.com/ + +[Bree]: https://jobscheduler.net/#/ diff --git a/config/index.js b/config/index.js index 29e227b..8b56558 100644 --- a/config/index.js +++ b/config/index.js @@ -20,7 +20,7 @@ const config = { appName: env.APP_NAME, appColor: env.APP_COLOR, twitter: env.TWITTER, - port: 4000, + port: 62_893, // build directory buildBase: 'build', diff --git a/index.js b/index.js index 83c585b..9682037 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,10 @@ const API = require('@ladjs/api'); +const jwt = require('koa-jwt'); + const api = require('./api'); const apiConfig = require('./config/api'); const config = require('./config'); -const jwt = require('koa-jwt'); function plugin(opts, Bree) { opts = { @@ -16,7 +17,7 @@ function plugin(opts, Bree) { ...apiConfig, port: opts.port, jwt: opts.jwt, - hookBeforeRoutes: (app) => { + hookBeforeRoutes(app) { app.use(jwt(opts.jwt)); } }); diff --git a/test/plugin/index.js b/test/plugin/index.js index 36fcb75..228b574 100644 --- a/test/plugin/index.js +++ b/test/plugin/index.js @@ -27,6 +27,6 @@ test('api does exist on bree instance', (t) => { t.is(typeof bree.api, 'object'); // options is set correctly by default - t.is(bree.api.config.port, 4000); + t.is(bree.api.config.port, 62_893); t.is(bree.api.config.jwt.secret, 'secret'); });