Skip to main content

What is routing and how routing works in Express.js?

Published 1 min readMarkdown
Part of seriesExpress
What is routing and how routing works in
Express.js?

Routing refers to determining how an application responds to a client request to a particular endpoint, which is a URI (or path) and a specific HTTP request method (GET, POST, and so on).

Each route can have one or more handler functions, which are executed when the route is matched.

The following example illustrates defining simple route. Respond with Hello World! on the homepage:

app.get('/', (req, res) => {
  res.send('Hello World!')
})

Source:

Express Basic Routing. expressjs.com/en/starter/basic-routing.html.

About the author

  • Full Stack Developer with a passion for building web applications. PHP, Node.js, Laravel, MySQL, MongoDB. Love collaborating & making a difference

No comments yet. Be the first to comment.

More from this blog