#Mean Stack APP This App has been built on MEAN Stack - MongoDB, Express JS, Node JS and Angular JS. It uses 'gulp' build tool in order to start the node server.
Steps to run the app:
- Clone the repository in some location.
- Once cloned, you can
cdinto MEAN-stack folder. - Open command prompt and run
npm installin order to install all the dependencies required by the app to run. - Once all the dependencies are installed, you can do
gulpto start the node server and navigate tohttp://localhost:9000in order to see the UI.
Pre-requisites
- You need to have MongoDB and NodeJS installed on your system.
- Make sure that mongo shell is up and running.
- On starting the server, the app will add few records to the Mongo Table, which will be visible right away.
How to run the API calls
- You will need to install Postman, a free Chrome extension. You can get it from here -> https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
- In order to perform
GETrequest, just navigate tohttp://localhost:9000/api/books/using Postman. - For
POSTrequest, navigate to the same link and add the following to request body (sample)
{
"genre": "Fiction",
"author": "Paulo Coelho",
"title": "The Alchemist"
}
- For
PUTrequest, navigate to the following link and add the following to request bodyhttp://localhost:9000/api/books/{id}
Note: You can get the ID from any of the books by issuing GET command.
{
"genre": "Fiction",
"author": "Paulo Coelho",
"title": "The Alchemist",
"read": true
}
The **read** property will get updated from false to true, keeping all other properties unchanged.
- For
PATCHrequest, you will have to get the ID by doingGETcommand and visit the link -http://localhost:9000/api/books/{id}and add the change to be made to request body. refer below
{
"title": "My Book",
}
- In order to
DELETEa resource, you need to visit the same link as above and just selectDELETEverb from the postman dropdown menu
Running Test cases
-
The test cases have been written in Protractor, which can be found in tests/e2e folder.
-
In order to run the test cases, first start the app server from command line by issuing
gulpcommand. Follow all the steps above in order to start the server. -
Once you have started the app server, you can issue
gulp testcommand from other console, in order to run the test cases.