Socket
Socket
Sign inDemoInstall

@tinyhttp/app

Package Overview
Dependencies
Maintainers
2
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 0.2.3 to 0.2.4

6

CHANGELOG.md
# @tinyhttp/app
## 0.2.4
### Patch Changes
- Fix #12 issue with type conflict
## 0.2.3

@@ -4,0 +10,0 @@

2

dist/app.d.ts

@@ -21,4 +21,4 @@ /// <reference types="node" />

}>);
handler(mw: Middleware[], req: Request, res: Response): Promise<void>;
handler(req: Request, res: Response): Promise<void>;
listen(port?: number, cb?: () => void, host?: string, backlog?: number): import("http").Server;
}

@@ -466,3 +466,4 @@ import { STATUS_CODES, METHODS, createServer } from 'http';

}
async handler(mw, req, res) {
async handler(req, res) {
const mw = this.middleware;
extendMiddleware(this.settings)(req, res);

@@ -478,4 +479,2 @@ const noMatchMW = {

const len = mw.length - 1;
// skip handling if only one middleware
// TODO: Implement next(err) function properly
const next = (err) => {

@@ -493,3 +492,4 @@ if (err) {

if (req.method === method) {
const queryParamStart = req.url.indexOf('?');
// strip query parameters for req.params
const queryParamStart = req.url.lastIndexOf('?');
const reqUrlWithoutParams = req.url.slice(0, queryParamStart === -1 ? req.url.length : queryParamStart);

@@ -530,3 +530,3 @@ if (rg(path).pattern.test(reqUrlWithoutParams)) {

const server = createServer((req, res) => {
this.handler(this.middleware, req, res);
this.handler(req, res);
});

@@ -533,0 +533,0 @@ return server.listen(port, host, backlog, cb);

import { Request } from './request';
import { Response } from './response';
export declare type NextFunction = (err?: any) => void;
export declare type SyncHandler = (req: Request, res: Response, next?: NextFunction) => void;
export declare type AsyncHandler = (req: Request, res: Response, next?: NextFunction) => Promise<void>;
export declare type SyncHandler = (req: Request, res: Response, next?: NextFunction | undefined) => void;
export declare type AsyncHandler = (req: Request, res: Response, next?: NextFunction | undefined) => Promise<void>;
export declare type Handler = AsyncHandler | SyncHandler;

@@ -7,0 +7,0 @@ export declare type ErrorHandler = (err: any, req: Request, res: Response) => void;

{
"name": "@tinyhttp/app",
"version": "0.2.3",
"version": "0.2.4",
"description": "tinyhttp core with App, Request, Response and Router",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

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