Last active
November 18, 2019 10:58
-
-
Save thomasswilliams/39c3d38b4c5b0ac88f7959f6edf6ee29 to your computer and use it in GitHub Desktop.
Express & TypeScript Pedals API base, Nov 2019 - server.ts
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
// in src directory | |
import express from "express"; | |
const app = express(); | |
// route: get pedals collection | |
app.get("/pedals", (req, res) => { | |
console.log("Got pedals collection"); | |
// hard-code JSON response | |
res.send({ pedals: [{ name: "Boss SY-1", id: 1 }] }); | |
}); | |
// port to listen on | |
const port = 34512; | |
// start Express server | |
app.listen(port, () => { | |
console.log(`Express server listening at http://localhost:${port}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment