Socket
Socket
Sign inDemoInstall

dylan

Package Overview
Dependencies
26
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dylan

A tiny lightning fast server, router, and middleware framework.


Version published
Weekly downloads
53
increased by20.45%
Maintainers
2
Install size
919 kB
Created
Weekly downloads
 

Readme

Source

Dylan

Middleware

A function that runs on any route and any method.

Route

A string or regex pattern on a particular method type handled by a dylan instance or a function(s).

Example

const dylan = require('dylan');
const static = require('@dylan/static');
const app = dylan();

app.use(/\/static.*/, static('public'));

app.get('/speak', (req, res) => {
  res.status('200').end('hi');
});

app.param('id', (req, res, next) => {
  if (accountExists(req.params.id)) {
    next();
  } else {
    res.sendStatus(404);
  }
});

app.get('/accounts/:id', (req, res) => {
  res.status('200').end(`Account "${req.params.id}"`);
});

app.get('/foo', preprehandle, prehandle, handle);

const subapp = dylan();
app.use('/docs', subapp);

app.listen(port);

Keywords

FAQs

Last updated on 17 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc