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

2ex

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

2ex

An opinionated express application framework

  • 1.0.0-3
  • latest
  • Source
  • npm
  • Socket score

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

2ex (pronounced 2X)

NPM Version NPM Downloads Build Status js-standard-style

A semi-opinionated framework for setting up Express apps.

Install

$ npm install --save 2ex

Usage

const createApp = require('2ex')

const runApp = createApp((app, opts = {}) => {
  // Handle app errors
  app.on('error', console.error)

  // Load in your routes
  app.get('/', (req, res) => {
    res.send(`Hello ${opts.message}!`)
  })
})

// Start the app
runApp({
  port: 8080,
  message: 'World'
}).then(({ app, server }) => {
  const addr = server.address()
  console.log(`Server started at http://${app.get('host')}:${addr.port}`)
})

What does it do?

This package sets up common requirements for running an Express app in production with the goal of reducing boilerplate in your applications. Here is a list of some of those things:

  • Uses next gen Express (5.0.0-alpha.7 at the time of publishing this)
  • Express app settings
    • Remove x-powered-by header
    • Sets query string parsing to simple (faster, more secure, planned default for 5.0)
  • Set process title (nice for identifying your server process)
  • Catch, report and exit on uncaughtException and unhandledRejection
  • Handle and report server clientErrors
  • Parses JSON bodies
  • Parses cookies (off by default, turn on by passing options.parseCookies

Keywords

FAQs

Package last updated on 06 Dec 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