Socket
Socket
Sign inDemoInstall

@fastify/middie

Package Overview
Dependencies
Maintainers
19
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastify/middie - npm Package Compare versions

Comparing version 8.0.0 to 8.1.0

.taprc

2

engine.js

@@ -104,3 +104,3 @@ 'use strict'

req.url = req.url.replace(result[0], '')
if (req.url.startsWith('/') === false) {
if (req.url[0] !== '/') {
req.url = '/' + req.url

@@ -107,0 +107,0 @@ }

@@ -8,3 +8,3 @@ 'use strict'

function middiePlugin (fastify, options, next) {
function fastifyMiddie (fastify, options, next) {
fastify.decorate('use', use)

@@ -66,5 +66,7 @@ fastify[kMiddlewares] = []

module.exports = fp(middiePlugin, {
module.exports = fp(fastifyMiddie, {
fastify: '4.x',
name: 'middie'
name: '@fastify/middie'
})
module.exports.default = fastifyMiddie
module.exports.fastifyMiddie = fastifyMiddie
{
"name": "@fastify/middie",
"version": "8.0.0",
"version": "8.1.0",
"description": "Middleware engine for Fastify",
"main": "index.js",
"types": "index.d.ts",
"types": "types/index.d.ts",
"scripts": {
"coverage": "tap --cov --coverage-report=html test.js",
"test": "standard && tap --no-coverage test/*.test.js && tsd"
"lint": "standard",
"lint:fix": "standard --fix",
"test": "standard && tap test/*.test.js && tsd",
"test:unit": "tap",
"test:typescript": "tsd"
},

@@ -34,8 +38,8 @@ "keywords": [

"devDependencies": {
"@fastify/pre-commit": "^2.0.2",
"@types/connect": "^3.4.33",
"@types/node": "^17.0.0",
"@types/node": "^18.0.1",
"cors": "^2.8.5",
"fastify": "^4.0.0-rc.2",
"helmet": "^5.0.0",
"pre-commit": "^1.2.2",
"helmet": "^6.0.0",
"serve-static": "^1.14.1",

@@ -45,16 +49,16 @@ "simple-get": "^4.0.0",

"tap": "^16.0.0",
"tsd": "^0.20.0",
"typescript": "4.7.3"
"tsd": "^0.25.0"
},
"dependencies": {
"fastify-plugin": "^3.0.0",
"fastify-plugin": "^4.0.0",
"path-to-regexp": "^6.1.0",
"reusify": "^1.0.4"
},
"tsd": {
"directory": "test"
},
"publishConfig": {
"access": "public"
}
},
"pre-commit": [
"lint",
"test"
]
}

@@ -1,8 +0,8 @@

# middie
# @fastify/middie
![CI](https://github.com/fastify/middie/workflows/CI/badge.svg)
[![NPM version](https://img.shields.io/npm/v/middie.svg?style=flat)](https://www.npmjs.com/package/middie)
[![NPM version](https://img.shields.io/npm/v/@fastify/middie.svg?style=flat)](https://www.npmjs.com/package/@fastify/middie)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
*middie* is the plugin that adds middleware support on steroids to [Fastify](https://www.npmjs.com/package/fastify).
*@fastify/middie* is the plugin that adds middleware support on steroids to [Fastify](https://www.npmjs.com/package/fastify).

@@ -15,3 +15,3 @@ The syntax style is the same as [express](http://npm.im/express)/[connect](https://www.npmjs.com/package/connect).

```
npm install middie
npm i @fastify/middie
```

@@ -26,3 +26,3 @@

const fastify = Fastify()
await fastify.register(require('middie'), {
await fastify.register(require('@fastify/middie'), {
hook: 'onRequest' // default

@@ -37,3 +37,3 @@ })

build()
.then(fastify => fastify.listen(3000))
.then(fastify => fastify.listen({ port: 3000 }))
.catch(console.log)

@@ -53,3 +53,3 @@ ```

async function subsystem (fastify, opts) {
await fastify.register(require('middie'))
await fastify.register(require('@fastify/middie'))
fastify.use(require('cors')())

@@ -64,3 +64,3 @@ }

fastify
.register(require('middie'))
.register(require('@fastify/middie'))
.register(subsystem)

@@ -82,3 +82,3 @@

fastify
.register(require('middie'))
.register(require('@fastify/middie'))
.register(subsystem)

@@ -110,3 +110,3 @@

fastify
.register(require('middie'), { hook: 'preHandler' })
.register(require('@fastify/middie'), { hook: 'preHandler' })
.register(subsystem)

@@ -144,3 +144,3 @@

fastify
.register(require('middie'))
.register(require('@fastify/middie'))
.register(subsystem)

@@ -166,3 +166,3 @@

```js
const Middie = require('middie/engine')
const Middie = require('@fastify/middie/engine')
const http = require('http')

@@ -169,0 +169,0 @@ const helmet = require('helmet')

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