Comparing version 1.0.2 to 1.0.3
@@ -6,11 +6,17 @@ "use strict"; | ||
// 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})) | ||
// // logs the request data to console in table form | ||
// const RL = new RequestLogger({ignore_urls : ['/logs'],showLatestFirst : false}) | ||
// const router = express.Router() | ||
// router.all('/', (req:Request, res:Response) : void => { | ||
// res.send("Hello world") | ||
// }) | ||
// app.use(RL.Console()) | ||
// app.use(RL.Webpage()) | ||
// app.all('/' , (req:Request, res:Response) : void => { | ||
// res.send(req.body) | ||
// }) | ||
// app.use(RL.Webpage({url : '/logs'})) | ||
// app.use(router); | ||
// app.listen(PORT, () : void => { | ||
@@ -17,0 +23,0 @@ // console.log(`Server started at port : ${PORT}`) |
@@ -11,4 +11,6 @@ import { Response, NextFunction } from 'express'; | ||
Console(): (req: any, _res: Response, next: NextFunction) => void; | ||
Webpage(): any; | ||
Webpage({ url }: { | ||
url: string; | ||
}): any; | ||
} | ||
export { RequestLogger }; |
@@ -8,3 +8,2 @@ "use strict"; | ||
const express_1 = __importDefault(require("express")); | ||
const cors_1 = __importDefault(require("cors")); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -21,5 +20,2 @@ const types_1 = require("./types"); | ||
this.app = express_1.default(); | ||
this.app.use(cors_1.default()); | ||
this.app.use(express_1.default.json()); | ||
this.app.use(express_1.default.urlencoded({ extended: true })); | ||
this.app.use(express_1.default.static(__dirname + 'src' + '/public')); | ||
@@ -65,7 +61,9 @@ this.app.set("views", path_1.default.join(__dirname, "views")); | ||
} | ||
Webpage() { | ||
Webpage({ url }) { | ||
// middleware setup | ||
this.app.get('/logs', (_, res) => { | ||
const router = express_1.default.Router(); | ||
router.get('/', (req, res) => { | ||
res.render('index', { logs: this.requests, params: this.parameters }); | ||
}); | ||
this.app.use(url, router); | ||
return this.app; | ||
@@ -72,0 +70,0 @@ } |
{ | ||
"name": "reqlogs", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "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.", | ||
@@ -28,6 +28,2 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@types/express": "^4.17.11", | ||
"@types/node": "^14.14.39", | ||
"console-table-printer": "^2.8.2", | ||
"cors": "^2.8.5", | ||
"ejs": "^3.1.6", | ||
@@ -37,2 +33,3 @@ "express": "^4.17.1" | ||
"devDependencies": { | ||
"cors": "^2.8.5", | ||
"@types/cors": "^2.8.10", | ||
@@ -39,0 +36,0 @@ "@types/express": "^4.17.11", |
@@ -5,12 +5,24 @@ // import express , {Request, Response} from 'express' | ||
// import {RequestLogger} from './request' | ||
// import cors from 'cors' | ||
// app.use(cors()) | ||
// app.use(express.json()) | ||
// app.use(express.urlencoded({extended:true})) | ||
// // logs the request data to console in table form | ||
// const RL = new RequestLogger({ignore_urls : ['/logs'],showLatestFirst : false}) | ||
// app.use(RL.Console()) | ||
// app.use(RL.Webpage()) | ||
// app.all('/' , (req:Request, res:Response) : void => { | ||
// res.send(req.body) | ||
// const router = express.Router() | ||
// router.all('/', (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 => { | ||
@@ -17,0 +29,0 @@ // console.log(`Server started at port : ${PORT}`) |
import express, {Request, Response, NextFunction, Router} from 'express' | ||
import cors from 'cors' | ||
import path from "path"; | ||
@@ -26,6 +25,2 @@ import {RequestLoggerProps, BOOTSTRAP_CLASSES} from './types' | ||
this.app.use(cors()) | ||
this.app.use(express.json()) | ||
this.app.use(express.urlencoded({extended:true})) | ||
this.app.use(express.static(__dirname+'src'+ '/public')) | ||
@@ -71,7 +66,9 @@ this.app.set( "views", path.join( __dirname, "views" ) ); | ||
} | ||
Webpage(){ | ||
Webpage({url} : {url : string}){ | ||
// middleware setup | ||
this.app.get('/logs' , (_ : Request, res:Response) => { | ||
const router = express.Router() | ||
router.get('/', (req:Request, res:Response) =>{ | ||
res.render('index', {logs:this.requests, params: this.parameters}); | ||
}) | ||
this.app.use(url, router) | ||
return this.app | ||
@@ -78,0 +75,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59701
2
486
13
- Removed@types/express@^4.17.11
- Removed@types/node@^14.14.39
- Removedconsole-table-printer@^2.8.2
- Removedcors@^2.8.5
- Removed@types/body-parser@1.19.5(transitive)
- Removed@types/connect@3.4.38(transitive)
- Removed@types/express@4.17.21(transitive)
- Removed@types/express-serve-static-core@4.19.6(transitive)
- Removed@types/http-errors@2.0.4(transitive)
- Removed@types/mime@1.3.5(transitive)
- Removed@types/node@14.18.63(transitive)
- Removed@types/qs@6.9.17(transitive)
- Removed@types/range-parser@1.2.7(transitive)
- Removed@types/send@0.17.4(transitive)
- Removed@types/serve-static@1.15.7(transitive)
- Removedconsole-table-printer@2.12.1(transitive)
- Removedcors@2.8.5(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedsimple-wcswidth@1.0.1(transitive)