You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
835 B
40 lines
835 B
"use strict";
|
|
import plugins from "@/plugins";
|
|
import { baseDir } from "@/util";
|
|
const Hapi = require("@hapi/hapi");
|
|
|
|
const run = async () => {
|
|
const server = Hapi.server({
|
|
port: 3000,
|
|
host: "localhost",
|
|
});
|
|
|
|
await server.register(plugins, {
|
|
routes: {
|
|
// prefix: "/api",
|
|
},
|
|
});
|
|
|
|
// https://hapi.dev/module/vision/api/?v=6.1.0
|
|
await server.register(require("@hapi/vision"));
|
|
server.views({
|
|
engines: {
|
|
ejs: require("ejs"),
|
|
},
|
|
isCached: process.env.NODE_ENV === "development" ? false : true,
|
|
compileMode: "sync",
|
|
relativeTo: baseDir,
|
|
layout: true,
|
|
path: "template",
|
|
});
|
|
|
|
await server.start();
|
|
console.log("Server running on %s", server.info.uri);
|
|
};
|
|
|
|
process.on("unhandledRejection", (err) => {
|
|
console.log("hh:", err);
|
|
process.exit(1);
|
|
});
|
|
|
|
export { run };
|
|
|