budibase/packages/server/src/index.js

22 lines
558 B
JavaScript
Raw Normal View History

2020-07-10 17:17:04 +02:00
const { resolve, join } = require("path")
const { homedir } = require("os")
2020-06-15 18:06:54 +02:00
async function runServer() {
2020-07-10 17:17:04 +02:00
const budibaseDir = join(homedir(), ".budibase");
process.env.BUDIBASE_DIR = budibaseDir
2020-06-15 18:06:54 +02:00
2020-07-10 17:17:04 +02:00
require("dotenv").config({ path: resolve(budibaseDir, ".env") })
2020-06-15 18:06:54 +02:00
2020-06-15 18:08:59 +02:00
const server = await require("./app")()
2020-07-10 17:17:04 +02:00
2020-06-15 18:06:54 +02:00
server.on("close", () => console.log("Server Closed"))
console.log(`Budibase running on ${JSON.stringify(server.address())}`)
}
2020-06-15 18:08:59 +02:00
runServer()
2020-07-10 17:17:04 +02:00
process.on("SIGINT", function() {
console.log("Shutting down server.." );
process.exit(1);
});