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

@tinyhttp/app

Package Overview
Dependencies
Maintainers
1
Versions
305
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/app - npm Package Compare versions

Comparing version 1.3.15 to 2.0.0

18

dist/index.js

@@ -80,7 +80,7 @@ import { STATUS_CODES, createServer } from 'http';

req.get = getRequestHeader(req);
if (settings === null || settings === void 0 ? void 0 : settings.bindAppToReqRes) {
if (settings?.bindAppToReqRes) {
req.app = app;
res.app = app;
}
if (settings === null || settings === void 0 ? void 0 : settings.networkExtensions) {
if (settings?.networkExtensions) {
req.protocol = getProtocol(req);

@@ -171,6 +171,6 @@ req.secure = req.protocol === 'https';

this.engines = {};
this.onError = (options === null || options === void 0 ? void 0 : options.onError) || onErrorHandler;
this.noMatchHandler = (options === null || options === void 0 ? void 0 : options.noMatchHandler) || this.onError.bind(null, { code: 404 });
this.onError = options?.onError || onErrorHandler;
this.noMatchHandler = options?.noMatchHandler || this.onError.bind(null, { code: 404 });
this.settings = options.settings || { xPoweredBy: true };
this.applyExtensions = options === null || options === void 0 ? void 0 : options.applyExtensions;
this.applyExtensions = options?.applyExtensions;
this.attach = (req, res) => setImmediate(this.handler.bind(this, req, res, undefined), req, res);

@@ -225,3 +225,2 @@ }

use(...args) {
var _a;
const base = args[0];

@@ -260,3 +259,3 @@ const fns = args.slice(1).flat();

for (const fn of fns) {
if (fn instanceof App && ((_a = fn.middleware) === null || _a === void 0 ? void 0 : _a.length)) {
if (fn instanceof App && fn.middleware?.length) {
for (const mw of fn.middleware) {

@@ -346,3 +345,2 @@ handlerPaths.push(lead(base) + lead(mw.path));

const handle = (mw) => async (req, res, next) => {
var _a;
const { path, handler, type, regex } = mw;

@@ -354,3 +352,3 @@ const params = regex ? getURLParams(regex, pathname) : {};

const first = Object.values(params)[0];
const url = req.url.slice(req.url.indexOf(first) + (first === null || first === void 0 ? void 0 : first.length));
const url = req.url.slice(req.url.indexOf(first) + first?.length);
req.url = lead(url);

@@ -363,3 +361,3 @@ }

req.path = getPathname(req.url);
if ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.enableReqRoute)
if (this.settings?.enableReqRoute)
req.route = getRouteFromApp(this, handler);

@@ -366,0 +364,0 @@ await applyHandler(handler)(req, res, next);

{
"name": "@tinyhttp/app",
"version": "1.3.15",
"version": "2.0.0",
"description": "0-legacy, tiny & fast web framework as a replacement of Express",

@@ -16,13 +16,4 @@ "type": "module",

},
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"module": "./dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json",
"./": "./"
},
"exports": "./dist/index.js",
"files": [

@@ -45,7 +36,7 @@ "dist"

"dependencies": {
"@tinyhttp/cookie": "1.3.0",
"@tinyhttp/proxy-addr": "1.3.0",
"@tinyhttp/req": "1.3.1",
"@tinyhttp/res": "1.3.3",
"@tinyhttp/router": "1.3.3",
"@tinyhttp/cookie": "2.0.0",
"@tinyhttp/proxy-addr": "2.0.0",
"@tinyhttp/req": "2.0.0",
"@tinyhttp/res": "2.0.0",
"@tinyhttp/router": "2.0.0",
"regexparam": "^2.0.0"

@@ -56,2 +47,2 @@ },

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