Answers for "get parameter from url server side node js"

0

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}`)
);
Posted by: Guest on April-04-2021

Code answers related to "get parameter from url server side node js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language