Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reqlogs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reqlogs - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

14

dist/index.js

@@ -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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc