This is a simple file that introduces the server-side MEAN stack. It uses Mongoose to simplify the interaction with Mongo-DB.
It currently doesn't use Module exports to clean up the code. Using MVC pattern makes it manageable and alot easier to read. My intention with this file is more of a reference guide to write server side code.
In this example, we are creating a simple serverside implementation for a blog. One can GET, POST, UPDATE, DELETE on both posts and comments of those posts. All calls are being passed as JSON.
GET /post
POST /post
PUT /post/:id
DELETE /post/:id
GET /post/:id/comment
POST /post/:id/comment
PUT/post/:id/comment/:Cid
DELETE /post/:id/comment/:Cid
curl -X POST http://localhost:3000/post -d "Name=MyLife"
curl -X POST http://localhost:3000/post/5454cbca2853abdcb60196f59f/comment -d "Name=MyFav"
curl -X PUT http://localhost:3000/post/54cbca2853abdcb60196f59f -d "Name=MyLife2"
curl -H "Content-Type: application/json" http://localhost:3000/post