@trenskow/app-express
v0.1.7
Published
A plugin for `@trenskow/app` that allows for using routes for express.`
Downloads
151
Readme
@trenskow/app-express
A plugin for @trenskow/app that enables it to handle express.js routes.
⚠️ Be aware that this plugin is experimental. Not all features of express is currently supported.
Installation and usage
Installation is pretty simple. You install it by registering the plugin.
import { Application, Endpoint } from '@trenskow/app';
import express from '@trenskow/app-express'
Application.plugin(express);
const app = new Application({ port: 8080 });
const root = new Endpoint()
.mount('ping', new Endpoint()
.express((req, res, /* next */) => {
res.json('pong')
}));
await app
.root(root)
.open();
LICENSE
See license in LICENSE.