Create a RESTful API that would allow an application to manage users and articles.
Before running this application, you should need the following programs installed:
Also, as optional I would recommend to install yarn (dependency manager) but you could use npm as well, which is installed with nodejs.
- Install dependencies by running the following command in your trusted command-line:bash
yarnor
npm install- To start the server:
Before starting the server, you probably would like to set some env variables such asSECRET_KEYorPORT.
Due to this API only has one authentication method, you must define theSECRET_KEYin order to communicate with the application.
By default ifSECRET_KEYis not defined, then the key is "aToken", please set up aSECRET_KEYas env variable.
In order to set env variables, you should create an.envfile at root of the project. Take as as example.sample.env.
yarn startor
npm run startAfter starting the server you could access to the documentation by hitting: http://localhost:3000/api/v0/api-docs/
This endpoint does not need authentication.
Note: 3000 is the port where the application is running but this could be change by env variable (process.env.PORT).
After completing step #1:
yarn testor
npm run testyarn test:coverageor
npm run test:coverageAfter running this command, you could see the coverage HTML generated in the folder "coverage" at root level of the project.