get parameter from url server side node js code example
Example: get parameter from url server side node js
const express = require("express");
//create express app
const app = express();
//port at which the server will run
const port = 4000;
//create end point
app.get("/", (request, response) => {
//send 'Hi, from Node server' to client
var city = request.param("city");
var country = request.param("country");
response.send(city);
});
//start server and listen for the request
app.listen(port, () =>
//a callback that will be called as soon as server start listening
console.log(`server is listening at http://localhost:${port}`)
);