Express JS(Part 02)

Express JS (Part 02)


What Is Express JS ?

Express JS is a web application framework. It provides a simple API to build websites , web apps and back ends. This provides the minimal interfaces to build the applications.It is flexible with the numerous modules available on npm.
Express JS was developed by TJ Holowaychuk and is maintained by the Node.js.


How To Setup And Configure?

As the very first step, we need to install the express-generator module on the system. 
it is very simple. Type npm install -g express-generator on command prompt and press enter to install.
As the next step create new express project using newly installed express generator.
For example, now you can try printing hello world in your project.

Try An Example To Print "Hello World"





  • In this image the first line has imported the express to our file.So that we have access to it through the variable 'express'.
  • app.get(route, callback) function provides the information when a get request at given route is called.
  • res.send() method is taking an object as input and it sends the hello world to the requesting client.
  • app.listen(port, [host], [backlog], [callback]]) function binds and listening to the connections of the specific host and the port.

Comments

Popular posts from this blog

"status": 404, "error": "not found", "message": "no message available", "path": "/api/employee"

There was an unexpected error (type=Not Found, status=404). No message available in Springboot