Created
December 6, 2020 18:02
-
-
Save soonsam123/ba6f4c2277cf47dd178c7e3e5fe6d157 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
const express = require("express"); | |
const app = express(); | |
app.listen(8000); | |
app.get("/dojos", function (req, res) { | |
res.send({ | |
id: 1, | |
name: "KARATÊ DOJO", | |
teacher: "JACKSON TANAKA", | |
}); | |
}); | |
app.use((req, res, next) => { | |
const error = Error("Not found"); | |
res.statusCode = 404; | |
res.send({ error: error.message }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment