Created
January 27, 2019 11:20
-
-
Save zprima/ffd6c13d3e2a2172189da741a69d9c87 to your computer and use it in GitHub Desktop.
medium_p1_c1
This file contains hidden or 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
const express = require("express"); | |
const bodyParser = require("body-parser"); | |
const app = express(); | |
const port = 3001; | |
// Middleware | |
// JSON parser middleware | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: true })); | |
app.get("/api/ping", (req, res) => { | |
// random endpoint so that the client can call something | |
res.json({ "msg": "pong" }) | |
}); | |
// start the Express server | |
app.listen(port, () => { | |
console.log(`server started at http://localhost:${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment