mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-14 21:31:50 +00:00
25 lines
549 B
JavaScript
25 lines
549 B
JavaScript
const fastify = require("fastify")({ logger: true });
|
|
const fastifyStatic = require("@fastify/static");
|
|
const path = require("path");
|
|
|
|
fastify.register(fastifyStatic, {
|
|
root: path.join(__dirname, "dist"),
|
|
wildcard: false,
|
|
});
|
|
|
|
fastify.get("*", (req, reply) => {
|
|
reply.sendFile("index.html");
|
|
});
|
|
|
|
fastify.listen({ port: 3002, host: '0.0.0.0' }, (err, address) => {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
console.log(`Server listening on ${address}`);
|
|
});
|
|
|
|
process.on("SIGTERM", () => {
|
|
fastify.close().then(() => {
|
|
process.exit(0);
|
|
});
|
|
});
|