It is a basic NodeJS web application exposing REST API that creates and stores user parameters in Redis database.
- Start a web server
- Create a user
- Get a user
This application is written on NodeJS and it uses Redis database.
-
Install application
Go to the root directory of the application (where package.json
file located) and run:
npm install
- Start a web server
From the root directory of the project run:
npm start
It will start a web server available in your browser at http://localhost:3000.
- Create a user
Send a POST (REST protocol) request using terminal:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"username":"sergkudinov","firstname":"sergei","lastname":"kudinov"}' \
http://localhost:3000/user
It will output:
{"status":"success","msg":"OK"}
Another way to test your REST API is to use Postman.
From the root directory of the project, run:
npm test