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
yarn
or
npm install
- To start the server:
Before starting the server, you probably would like to set some env variables such asSECRET_KEY
orPORT
.
Due to this API only has one authentication method, you must define theSECRET_KEY
in order to communicate with the application.
By default ifSECRET_KEY
is not defined, then the key is "aToken", please set up aSECRET_KEY
as env variable.
In order to set env variables, you should create an.env
file at root of the project. Take as as example.sample.env
.
yarn start
or
npm run start
After 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 test
or
npm run test
yarn test:coverage
or
npm run test:coverage
After running this command, you could see the coverage HTML generated in the folder "coverage" at root level of the project.