Skip to content

Instantly share code, notes, and snippets.

@soonsam123
Created December 6, 2020 18:02
Show Gist options
  • Save soonsam123/ba6f4c2277cf47dd178c7e3e5fe6d157 to your computer and use it in GitHub Desktop.
Save soonsam123/ba6f4c2277cf47dd178c7e3e5fe6d157 to your computer and use it in GitHub Desktop.
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