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

diet-connect

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diet-connect

Compatibility layer for using Connect/Express middleware in diet.js apps

  • 1.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

diet-connect

Compatibility layer for using Connect/Express middleware in diet.js apps

Use your favorite Express middleware out of the box

const compatible = require('diet-connect')
const logger = require('morgan')
const serve = require('express-static')
...
app.header(compatible(logger('dev')))
app.footer(compatible(serve(app.path + 'static')))

Proxies any assignment to req object by middleware to the signal object ($). For example, using express session usually adds .session to req; here it's attached to $

const session = require('express-session')
app.header(compatible(session(options)))

app.get('/counter', function ($) {
	$.session.views = $.session.views || 0
	$.session.views++
	$.end('you have viewed this page ' + $.session.views + ' times')
})
// refresh the page to see the counter go up

Examples

Examples

Known Incompatible Modules

  • body-parser Diet is inherently incompatible with Express' body parser, as Diet already does body parsing

Contact

Bug reports, feature requests, and questions are all welcome: open a GitHub issue and I'll get back to you.

This is especially true if a certain piece of middleware doesn't work. Please open an issue and I'll see what we need to do to get compatibility.

Keywords

FAQs

Package last updated on 18 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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