Jibble test for backend.
Feel free to use the code editor of your choice. It has prettier-eslint setup;
Visual Studio and Atom have a nice plugin to format and enforce eslint on file
save, you can configure them in the next section.
Make sure you have prettier-vscode plugin installed
ext install prettier-vscodeAlso following settings in your workspace settings:
{
"editor.formatOnSave": true,
"prettier.eslintIntegration": true
}Make sure you have prettier-atom plugin installed
apm install prettier-atom- Automatically format on save (requires enabling in
Packages → Prettier →Toggle Format on Save) - Check the
ESLint Integrationcheckbox
- Hapi
- Jest
- ES7
- Prettier
- ESLint
- Gulp
In order to support async/await, you must be running at least version 7.6,
if you have nvm, make sure you are using that version.
Run the code below:
git clone git@github.com:sorioinc/nodejs-backend.git
cd nodejs-backend/
npm installThere is no building made (transpilation), this is a Vanilla JS project. But to run the project, you can execute the following command:
npm startor if you prefer a live server, that's listening for code changes, then try:
gulp watchThe project runs on Jest. You can use any of these command lines:
npm testor
gulp testYou can also access the coverage reports for the project, that is automatically
generated by Jest. They are located in coverage/ directory.
The style is driven by ESLint, and it's based upon Airbnb's configuration. Plus,
it makes use of Prettier as a formatter. It is enforced with git commit hooks.
We urge you to use the linter to check for javascript / style errors, and
prettier to format the code:
gulp lintand
gulp prettieror just
gulp prettifywhich takes care of both.
Api documentation is provided by Swagger, you can find it at the server:port the app is running at, for example: http://localhost:3000/documentation
Hapi has plugins for caching, created by the same core development team. So it offers it out of the box, it also includes external bindings for Redis, MongoDB, Riak and many more.
For the request throttling, we can use a limitd plugin called patova, which we can just plug in less than 10 lines of code, this will allow us to control the page requests for any given user.
