{"library":"morgan","title":"Morgan HTTP Logger","description":"Morgan is an HTTP request logger middleware for Node.js, often used with the Express framework. It allows developers to log request details such as method, URL, status, and response time in various predefined or custom formats. The current stable version is 1.10.1. Releases occur infrequently, with the latest update focusing on minor fixes and dependency updates, indicating a mature and stable library.","language":"javascript","status":"active","last_verified":"Sat Apr 18","install":{"commands":["npm install morgan"],"cli":null},"imports":[],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const express = require('express');\nconst morgan = require('morgan');\nconst app = express();\nconst port = process.env.PORT ?? 3000;\n\n// Use 'dev' format for concise colored output during development\napp.use(morgan('dev'));\n\napp.get('/', (req, res) => {\n  res.send('Hello World!');\n});\n\napp.get('/error', (req, res) => {\n  res.status(500).send('Something broke!');\n});\n\napp.listen(port, () => {\n  console.log(`Example app listening on port ${port}`);\n});","lang":"javascript","description":"This quickstart sets up a basic Express.js application and integrates Morgan middleware using the 'dev' format for logging HTTP requests. It demonstrates how Morgan logs incoming requests and their responses, including status codes and response times.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}