Created
November 1, 2017 15:37
-
-
Save ZaninAndrea/de5dcfe986dac998c736b2eb38087594 to your computer and use it in GitHub Desktop.
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
// init project | |
const express = require('express'); // the library we will use to handle requests | |
const app = express(); // instantiate express | |
app.use(require("cors")()) // allow Cross-domain requests | |
// base route | |
app.get("/", function (request, response) { | |
response.send("TODO") // always responds with the string "TODO" | |
}); | |
// base route | |
app.post("/", function (request, response) { | |
response.send("TODO") // always responds with the string "TODO" | |
}); | |
app.put("/", function (request, response) { | |
response.send("TODO") // always responds with the string "TODO" | |
}); | |
// listen for requests, the process.env.PORT is needed because | |
// we are using glitch, otherwise you could have written 80 or whatever | |
var listener = app.listen(process.env.PORT, function () { | |
console.log('Your app is listening on port ' + listener.address().port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment