Answers for "node js get get parameter from url i]"

9

js get url parameter

const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const code = urlParams.get('code')
Posted by: Guest on October-18-2020
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 "Javascript"

Browse Popular Code Answers by Language