Skip to content

sorioinc/nodejs-backend

Repository files navigation

Logo of the project

Jibble Test

Jibble test for backend.

Installing / Getting started

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.

For Visual Studio Code

Make sure you have prettier-vscode plugin installed

ext install prettier-vscode

Also following settings in your workspace settings:

{
  "editor.formatOnSave": true,
  "prettier.eslintIntegration": true
}

For Atom

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 Integration checkbox

Development

Built With

  • Hapi
  • Jest
  • ES7
  • Prettier
  • ESLint
  • Gulp

Prerequisites

Node

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.

Setting up Dev

Run the code below:

git clone git@github.com:sorioinc/nodejs-backend.git
cd nodejs-backend/
npm install

Building

There is no building made (transpilation), this is a Vanilla JS project. But to run the project, you can execute the following command:

npm start

or if you prefer a live server, that's listening for code changes, then try:

gulp watch

Tests

The project runs on Jest. You can use any of these command lines:

npm test

or

gulp test

You can also access the coverage reports for the project, that is automatically generated by Jest. They are located in coverage/ directory.

Style guide

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 lint

and

gulp prettier

or just

gulp prettify

which takes care of both.

Documentation

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

Caching and Request Throttling

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors