reqlogs
Version:
A simple logger, which logs the request to server in form of tables, it helps to debug the connection with client and can also be used for metrics.
39 lines (38 loc) • 1.34 kB
JavaScript
;
// import express , {Request, Response} from 'express'
// const app = express()
// const PORT = process.env.PORT || 8080
// import {RequestLogger} from './request'
// import cors from 'cors'
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestLogger = void 0;
// app.use(cors())
// app.use(express.json())
// app.use(express.urlencoded({extended:true}))
// const parameters = {
// time: true,
// method: true,
// path : true,
// query : true,
// body : true
// }
// // an array of paths you want the logger to ignore
// const ignore_urls = ['/a', '/b']
// // logs the request data to console in table form
// const RL = new RequestLogger({ignore_urls,parameters,showLatestFirst : false})
// const router = express.Router()
// router.all('/', (req:Request, res:Response) : void => {
// res.send("Hello world")
// })
// router.all('/another',(req:Request, res:Response) : void => {
// res.send("Hello world")
// })
// app.use(RL.Console())
// app.use(RL.Webpage({url : '/logs'}))
// app.use(router);
// app.listen(PORT, () : void => {
// console.log(`Server started at port : ${PORT}`)
// })
// Copy all the view templates
const request_1 = require("./request");
Object.defineProperty(exports, "RequestLogger", { enumerable: true, get: function () { return request_1.RequestLogger; } });