Skip to content

Latest commit

 

History

History

Router

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Router

what is Router

  • 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).*/

install

  • We can install NodeMailer from terminal using the command npm install express

why does need routing

*Routing is the hub around which all of IP connectivity revolves. At the simplest level, routing establishes basic internetwork communications, implements an addressing structure that uniquely identifies each device, and organizes individual devices into a hierarchical network structure. *it is very helpfull in single page application ex:-react applicaion

router method

  • app.method(path, handler)
  • This METHOD can be applied to any one of the HTTP verbs – get, set, put, delete. An alternate method also exists, which executes independent of the request type.

*Path is the route at which the request will run. *see example in router file

router path

*A routing path is a combination of a request method to define the endpoints at which requests can be made by a client. Route paths can be strings, string patterns, or regular expressions. *see example in router file