New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

systemic-express

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

systemic-express

A systemic express component

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
439
increased by18.97%
Maintainers
0
Weekly downloads
 
Created
Source

Maintainability Test Coverage

systemic-express

A systemic set of components for making easier setting up systemic-based express applications. These components are:

App

This component contains customizable express application configuration. The whole list of options can be found here.

const System = require ('systemic');
const app = require('systemic-express').app

new System()
    .configure({
        app: {
            // This is the default configuration
            etag: false,
            'x-powered-by': false,
        }
    })
    .add('app', app()).dependsOn('config')

Default middleware

Provides two different middlewares that can be attached to the previously created application as root level middlewares. By default, this middlewares will log errors, but they can be easily overridden by passing a configuration object to the component as follows:

const System = require ('systemic');
const app = require('systemic-express').app
const defaultMiddleware = require('systemic-express').defaultMiddleware

const routes = require('./lib/routes')

new System()
    .configure({
        app: {
            etag: false,
            'x-powered-by': false,
        },
        'middleware.default': {
            // Override default notFound error handler here    
            notFound(err, req, res, next) {
                // Do some not found error handling magic
            },
            // Override default generic error handler here
            error(err, req, res, next) {
                // Do some generic error handling magic
            }
        }
    })
    .add('app', app()).dependsOn('config')
    .add('routes', routes()).dependsOn('app')
    .add('middleware.default', defaultMiddleware()).dependsOn('routes', 'app')

Server

This component makes easier to set up the express server that will expose your application. It accepts the same options as the listen method:

const System = require('systemic')
const server = require('systemic-express').server
const app = require('systemic-express').app
const defaultMiddleware = require('systemic-express').defaultMiddleware
const routes = require('./lib/routes')

new System()
    .configure({
        server: {
            // Default value
            host: '0.0.0.0',
            // Mandatory field
            port: 3000
        },
        app: {
            etag: true
        }
    })
    .add('app', app()).dependsOn('config')
    .add('routes', routes()).dependsOn('app')
    .add('middleware.default', defaultMiddleware()).dependsOn('routes', 'app')
    .add('server', server()).dependsOn('config', 'app', 'middleware.default')
    .start((err, components) => {
        // Do stuff with components
    })

Keywords

FAQs

Package last updated on 23 Jan 2025

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