1.3.4 • Published 2 years ago

@booji/express v1.3.4

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
2 years ago

@booji/express

Express端SDK,本包在 @booji/node 的基础上添加了Express的中间件

使用示例

点击这里了解 Express 的 ErrorHandler

import express from "express";
import { init, ErrorHandler } from "@booji/node"

// 使用CommonJS
// const express = require('express');
// const { init } = require('@booji/node');

const app = express();

init({
  dsn: "xxx",
  appKey: "xxx"
})

app.use('/', rootHandler);
app.use('/other', otherHandler);

// Booji错误中间件必须在`所有控制器后`使用
app.use(ErrorHandler);

// 可选:如果Booji错误中间件无法满足需求,也可以自定义错误中间件
app.use((err, req, res, next) => {
  // render the error page
  res.status(err.status || 500);
  res.render('error');
});

app.listen(3000);
1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago