budibase/packages/server/src/index.js

20 lines
551 B
JavaScript
Raw Normal View History

2020-07-10 17:17:04 +02:00
const { resolve, join } = require("path")
const { homedir } = require("os");
const { app } = require("electron");
2020-06-15 18:06:54 +02:00
async function runServer() {
const homeDir = app ? app.getPath("home") : homedir();
const budibaseDir = join(homeDir, ".budibase")
2020-07-10 17:17:04 +02:00
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()