Last active
January 19, 2024 21:59
-
-
Save degrammer/37f13a470d46fb409a1efb0138f6f864 to your computer and use it in GitHub Desktop.
quick server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const http = require('http'); | |
const url = require('url'); | |
const server = http.createServer((req, res) => { | |
const parsedUrl = url.parse(req.url, true); | |
const queryStringParams = parsedUrl.query; | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end(`The code parameter is: ${queryStringParams.code || 'Not provided'}\n`); | |
}); | |
const PORT = 51772; | |
server.listen(PORT, () => { | |
console.log(`Server running at http://localhost:${PORT}/`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "quick-server", | |
"version": "1.0.0", | |
"bin": "./index.js" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run this via
npx https://gist.github.com/degrammer/37f13a470d46fb409a1efb0138f6f864