showing results for - "get parameter from url server side node js"
Maura
04 Mar 2020
1const express = require("express");
2//create express app
3const app = express();
4//port at which the server will run
5const port = 4000;
6//create end point
7app.get("/", (request, response) => {
8  //send 'Hi, from Node server' to client
9  var city = request.param("city");
10  var country = request.param("country");
11  response.send(city);
12  
13});
14
15//start server and listen for the request
16app.listen(port, () =>
17  //a callback that will be called as soon as server start listening
18  console.log(`server is listening at http://localhost:${port}`)
19);
20