Skip to content

ProfessorSolo/Node2Know-ExpressLoggingWithMorgan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node2Know — Express Logging with Morgan

A minimal Express app demonstrating request logging using the morgan middleware.

Morgan logs every incoming request:

  • HTTP method
  • URL
  • status code
  • response time

Perfect for development and debugging.


✅ Prereqs

  • Node.js
  • npm

Check:

node -v
npm -v

📦 Install

npm install

▶️ Run

npm start

🧪 Try it

Open these routes and watch your terminal:

  • http://localhost:3000/
  • http://localhost:3000/things

You’ll see logs like:

GET /things 200 3.123 ms - 52

👀 Watch mode

npm run watch

Stop with:

  • Ctrl + C

🧠 Key idea

app.use(morgan("dev"));
  • Morgan is just middleware
  • it must be registered before your routes
  • 'dev' format is ideal for local development

📁 Project Structure

.
├── app.js
├── package.json
└── README.md

Repo


License

Node2Know-LEARN-1.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors