With Express
terminal
bash
npm i express
npm i --save-dev @types/express
terminal
bash
npm i express
npm i --save-dev @types/express
Example
server.ts
ts
import { initBridge, handler } from 'bridge';
import express from 'express';
const hello = handler({
resolve: () => 'hello',
});
const bridge = initBridge({ routes: { hello } });
const port = 8080;
const app = express();
app.use('', bridge.expressMiddleware());
app.listen(port, () => {
`Listening on port ${port}`;
});
server.ts
ts
import { initBridge, handler } from 'bridge';
import express from 'express';
const hello = handler({
resolve: () => 'hello',
});
const bridge = initBridge({ routes: { hello } });
const port = 8080;
const app = express();
app.use('', bridge.expressMiddleware());
app.listen(port, () => {
`Listening on port ${port}`;
});