Express 集成
Express 集成是unioc
的内置集成,不需要单独安装,只需要安装unioc
主包即可。
创建并启动App
ts
import { ExpressApp } from 'unioc/web-express'
async function bootstrap(): Promise<void> {
// 创建一个 Express 应用
const app = new ExpressApp()
// 直接运行
await app.run(3000).then(() => {
console.log(`Express server is running at http://localhost:3000`)
})
}
bootstrap()