-
@modern-js/app-tools 是有暴露命令 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
@yimingjfe 看看~ |
Beta Was this translation helpful? Give feedback.
-
ping @yimingjfe |
Beta Was this translation helpful? Give feedback.
-
@baranwang 目前可以通过增加一个 bootstrap 文件去启动 server,一个可参考的示例如下: const path = require("path");
const server = require("@modern-js/prod-server").default;
const pluginBFF = require("@modern-js/plugin-bff/server").default;
const pluginKoa = require("@modern-js/plugin-koa/server").default;
async function bootstrap() {
const config = {
output: {
path: ".",
},
bff: {
prefix: "/api",
},
};
try {
const app = await server({
config,
pwd: __dirname,
serverConfigFile: "modern.server-runtime.config",
plugins: [pluginBFF(), pluginKoa()],
appContext: {
sharedDirectory: path.join(__dirname, "shared"),
apiDirectory: path.join(__dirname, "api"),
lambdaDirectory: path.join(__dirname, "api/lambda"),
},
});
const port = 8080;
app.listen(port);
} catch (error) {
console.error(error);
process.exit(1);
}
}
bootstrap(); 这样只需要安装 server 相关的依赖。 |
Beta Was this translation helpful? Give feedback.
-
补充回复一下,部署相关的内容可以查看 https://modernjs.dev/zh/guides/basic-features/deploy.html |
Beta Was this translation helpful? Give feedback.
@baranwang 目前可以通过增加一个 bootstrap 文件去启动 server,一个可参考的示例如下: