Skip to content

Instantly share code, notes, and snippets.

@shunghsiyu
Last active August 23, 2017 09:41
Show Gist options
  • Save shunghsiyu/60701b5ddb00298f31fbcf42f60b0fdb to your computer and use it in GitHub Desktop.
Save shunghsiyu/60701b5ddb00298f31fbcf42f60b0fdb to your computer and use it in GitHub Desktop.
Show the query URL
const express = require('express')
const app = express()
app.get('*', function (req, res) {
res.send(`<body style="white-space: pre-wrap" width="100%" height="100%">
You are visiting: ${req.path}
You send the following query:
${JSON.stringify(req.query, null, 4)}
</body>
`)
})
app.listen(8080, function () {
console.log('Listening on port 8080!')
})
{
"name": "urlquery",
"version": "0.1.0",
"description": "Display the query URL",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.15.4"
},
"scripts": {
"start": "node app.js"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment