to run on port we have to use some middle wares or frameworks
below listed are middlewares
express js
koa
hapi
what is express js
it is a framework
it is opensource
we can devbelop web applicatiosn and apis
it is scalable
fast app development
it is user frendly and customizable
we can intergrate easily third party services and middlewares
package.json
whenerver package is isntalled it will show in dependecies-> package.json
ito install an y applications, it will be possible by commands
npm install express
write belw code in second.js file
console.log(req) - it shows total object
if (req.url ==='/'){
res.end('welcome')
}
default output
res.end('oops')
\then call in terminal by node second.js
based on code it wil run in this url
http://localhost:3000/
what ever u required- u have to import
after that u have to export if u wanna use in some other file
as per code it will print in condole log
No comments:
Post a Comment