thingies
This commit is contained in:
parent
eecbca3801
commit
e35839318b
50 changed files with 5279 additions and 2 deletions
|
|
@ -1,8 +1,24 @@
|
|||
const express = require("express");
|
||||
const app = express();
|
||||
|
||||
const requestLogger = (request, response, next) => {
|
||||
console.log("Method:", request.method);
|
||||
console.log("Path: ", request.path);
|
||||
console.log("Body: ", request.body);
|
||||
console.log("---");
|
||||
next();
|
||||
};
|
||||
|
||||
const unknownEndpoint = (request, response) => {
|
||||
response.status(404).send({ error: "unknown endpoint" });
|
||||
};
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
app.use(requestLogger);
|
||||
|
||||
app.use(unknownEndpoint);
|
||||
|
||||
const persons = [
|
||||
{
|
||||
id: "1",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue