Skip to content

Cell - Express 适配器组件 ​

HTTP 应用的后端入口:它启动应用并使用 node:http 服务。尽管名字,它不再依赖 express;处理器是 @celljs/web 的 HttpServerUtil.createHandler()。

bash
npm install @celljs/express-adapter

每个 HTTP 后端都需要它(cell init 模板包含它)。node、cloudflare、fc、scf、lambda 和 vercel preset 都运行这个入口;cli preset 不需要它。

键默认值
server.host127.0.0.1在容器中使用 0.0.0.0:CELL_SERVER__HOST=0.0.0.0
server.port3000CELL_SERVER__PORT 覆盖它;'${env.PORT}' 跟随平台的 PORT
server.path/每个路由的基础路径

在 cell dev 和 createTestApp() 下,入口把其请求处理器交给工具链而不是自己监听。