How to use the token function from morgan
Find comprehensive JavaScript morgan.token code examples handpicked from public code repositorys.
64 65 66 67 68 69 70 71 72 73 74res.status(404).end(); }); app.post("/api/persons", (req, res) => { const body = req.body; morgan.token("body", (req, res) => JSON.stringify(req.body)); if (!body.name || !body.number) { res.status(400).json({ error: "malformed request body" }); } else if (persons.find((p) => p.name === body.name)) { res.status(400).json({ error: "name must be unique" });
+ 2 other calls in file
GitHub: transloadit/uppy
71 72 73 74 75 76 77 78 79} router.use(addRequestId) // log server requests. router.use(morgan('combined')) morgan.token('url', (req) => { const { query, censored } = censorQuery(req.query) return censored ? `${req.path}?${qs.stringify(query)}` : req.originalUrl || req.url })
+ 15 other calls in file
morgan.token is the most popular function in morgan (19 examples)