Based Node.js room reservation API.
- [node.js] - Javascript runtime runtime environment
- [MongoDB] - NoSql database , i used a cloud solution which is Atlas
- [Express] - Markdown parser done right. Fast and easy to extend.
- [Maildev] - local server to test mailing trafic on localhost
- [Express] - sweet node.js framework to create Rest API
- [npm] - node package manager
- [Mocha & Chai] - for unit test
- [nyc] - for code coverage
- [git] - used for version control
Clone the project
$ git clone https://github.com/mnmajd/majd-test-CN.git
Go to project directory
$ cd majd-test-CN
Install project dependencies
$ npm install
Install maildev globaly
$ npm install -g maildev
Start project
$ npm run dev
Start maildev server
$ maildev
Access maildev web UI
$ go to http://0.0.0.0:1080
- GET apartments http://localhost:4500/api/v1/apartment
- POST apartment http://localhost:4500/api/v1/apartment
- GET apartment by id http://localhost:4500/api/v1/apartment/ida
- PUT apartment http://localhost:4500/api/v1/apartment/ida
- DELETE apartment http://localhost:4500/api/v1/apartment/ida
- GET rooms http://localhost:4500/api/v1/room
- POST room http://localhost:4500/api/v1/room
- GET room by id http://localhost:4500/api/v1/apartment/idr
- PUT room http://localhost:4500/api/v1/apartment/idr
- DELETE room http://localhost:4500/api/v1/apartment/idr
- Book room by client http://localhost:4500/api/v1/apartment/idr/idc
- GET clients http://localhost:4500/api/v1/client
- POST client = register http://localhost:4500/api/v1/client/singup
- POST client = login http://localhost:4500/api/v1/client/login
- GET client by id http://localhost:4500/api/v1/client/idc
- PUT client http://localhost:4500/api/v1/client/idc
- DELETE client http://localhost:4500/api/v1/client/idc
Client
{
"firstName": "",
"lastName": "",
"email": "",
"phone": "",
"birthDate": "",
"nationality": "",
"password" : ""
}
Apartment
{
"name" : "",
"street" : "",
"zipCode": "",
"city" : ""
}
Room
{
"number" : ,
"area" : ,
"price" : ,
"Apartment" : ""
}
3- Grant access for booking API so that only users who are logged in can access to the endpoint thats why you should add a Token
to the header of the request.
$ npm run test
$ npm run cov
- Deploy on Heroku
- More unit tests to gain more code coverage
- Create Docker Image and deploy it on a docker repository