Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
Ravi Vishwakarma
03-Apr-2025In Express (a Node.js web framework), you define a route using methods like
app.get()
,app.post()
,app.put()
, etc., depending on the HTTP verb you want to handle.Here’s the basic syntax:
Breakdown:
app.get()
defines a GET route.The first argument (
'/example'
) is the route path.The second argument is a callback function (called a route handler) with
req
(request) andres
(response) parameters.res.send()
sends a response to the client.Other common HTTP methods: