Created
January 22, 2020 14:33
-
-
Save prof3ssorSt3v3/af0294835b7fb9280d7950866c911695 to your computer and use it in GitHub Desktop.
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
"use strict"; | |
const express = require("express"); | |
const app = express(); | |
app.get("/", (req, res) => { | |
console.log(req.headers); | |
console.log(req.url); | |
console.log(req.ip); | |
console.log(req.hostname); | |
console.log(req.method); //get | |
console.log(req.protocol); //http /https | |
console.log(req.path); // just the path part of the url | |
console.log(req.subdomains); // test.sales.example.com ['test','sales] | |
console.log(req.query); // querystring | |
console.log(req.params); // /user/72 /product/234234 | |
// app.get("/user/:id") app.get("/product/:id") | |
// req.params.id | |
res.status(404).end(); | |
}); | |
//app.post("/thing"); | |
app.listen(3000, err => { | |
if (err) { | |
console.log("there was a problem", err); | |
return; | |
} | |
console.log("listening on port 3000"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment