We shall discuss about the files that are generated by the command.Please view the previous blogpost if you
haven’t already.
https://angularnest.blogspot.com/2018/10/retrieving-data-from-expressjs-enpoint.html
https://angularnest.blogspot.com/2018/10/retrieving-data-from-expressjs-enpoint.html
This file mark the starting point we need be concerned of.We need to require express package that in the nodemodules
var express = require('express');
Then
var app = express();
To use express js in our application
var indexRouter = require('./routes/index');
app.use('/', indexRouter);
This tells if the route is localhost:3000/ , then use the webapi indexRouter
If we wish to get the resource in localhost:3000/hi, then in index.js update
This will print fsdfs as json in our screen on navigating to localhost:3000/hi
We can use this api resource in our angular application.In the next tutorial we will discuss how to hit
api and retrieve it in our angular application.
api and retrieve it in our angular application.
Comments
Post a Comment