1. install express
npm init
npm install --save express
for nodemon use it as development dependency
npm install --save-dev nodemon
and in the scripts use start for nodemon app.js
For following MVC way model view and controller
create 2 folders controllers and routers => controllers will have logic after routes are handled
and in routes routing is handled
Under Routes > routes.js
1. use express
then routes = express. router()
this router has to be exported as module
for defining routes use
router.get('/post',feedcontroller.getpost)
under feed controller => feed.js
create a function for the each routes as diffrent modiles
As it is Api so response is set as Json
in app.js
for parsing incomming request body parser is to be used as json
install it as
npm install --save body-parser
extracting data from body