Build a web api to publish and read course results using nodejs and mongodb.
For development, you will only need Node.js, a node global package npm and MongoDb installed in your environement.
├── diagrams # Have documentation files
├── src # Source files
├── api
├── controller # Used in applying validations and calling servcie
├── middlewares # Auth and schema validation layer
├── routes.js
├── config # Configration
├── model # DataBase Models (MongoDB)
├── service # Have the logic
├── utilit
├── app.js
├── uploads # Courses csv files
├── README.md
├── server.js # Runing thre server
-
Just go on official Node.js website and download the installer. Also, be sure to have
gitavailable in your PATH,npmmight need it (You can find git here).
If the installation was successful, you should be able to run the following command.
$ node --version
v8.11.3
$ npm --version
6.1.0
Just go on official MongoDB website and download the installer.
$ git clone https://github.com/khaledesmail/course
$ cd course
$ npm install
$ Run MongoDB
$ C:\path\to\mongodb\bin\mongod.exe
$ npm start
1- /signup
curl --location --request POST 'localhost:8080/rest/api/v1/profile/signup' \
--header 'Content-Type: application/json' \
--header 'correlationID: 9d4565448f269aaa3d663dd2ee3c27aa' \
--data-raw '{
"firstName": "khaled",
"lastName": "email",
"email": "khaled.esmail@gmail.com",
"password": "12345678",
"userName": "khaled22"
}'2- /signin
curl --location --request POST 'localhost:8080/rest/api/v1/profile/signin' \
--header 'Content-Type: application/json' \
--header 'correlationID: 9d4565448f269aaa3d663dd2ee3c27aa' \
--data-raw '{
"password": "12345678",
"userName": "khaled22"
}'Then you will use token in the signin response in APIs whihc required authentication.