Answers for "express get current url"

5

jquery get current url

var currentURL = $(location).attr('href'); //jQuery solution
var currentURL = window.location.href; // raw javascript
Posted by: Guest on July-23-2019
4

express get full url

var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;
Posted by: Guest on June-10-2020
0

express get raw path

const url = require('url');
const express = require('express');

const app = express();
app.use((req, res, next) => {
  const path = url.parse(req.url).path;
  // Do something...
});

const port = 3000;
app.listen(port, console.log(`Listening on port ${port}.`));
Posted by: Guest on August-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language