0.2.12 • Published 5 months ago

dylan v0.2.12

Weekly downloads
2
License
MIT
Repository
github
Last release
5 months ago

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);
0.2.12

5 months ago

0.2.9

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.7

3 years ago

0.2.8

3 years ago

0.0.1

6 years ago

0.0.0

6 years ago