Files
getting-started/nodejs/logging-file/app-console.js
Olaoluwa Ajibade 126fa44d97 Adding NodeJs Logging CodeExamples (#199)
* Adding NodeJs Logging CodeExamples

* Adding NodeJs Logging CodeExamples
2022-07-25 09:51:25 +10:00

22 lines
519 B
JavaScript

const express = require("express");
const app = express();
app.get("/", (req, res, next) => {
console.log("debug", "Hello, Winston!");
console.log("The is the home '/' route.");
res.status(200).send("Logging Hello World..");
});
app.get("/event", (req, res, next) => {
try {
throw new Error("Not User!");
} catch (error) {
console.error("Events Error: Unauthenticated user");
res.status(500).send("Error!");
}
});
app.listen(3000, () => {
console.log("Server Listenning On Port 3000");
});