1
0
Fork 0
mirror of synced 2024-09-10 06:26:02 +12:00
budibase/packages/server/src/index.js

23 lines
595 B
JavaScript
Raw Normal View History

2020-07-11 03:17:04 +12:00
const { resolve, join } = require("path")
2020-07-14 05:11:19 +12:00
const { homedir } = require("os")
const { app } = require("electron")
2020-07-14 20:10:01 +12:00
const fixPath = require("fix-path")
2020-06-16 04:06:54 +12:00
async function runServer() {
2020-07-14 05:11:19 +12:00
const homeDir = app ? app.getPath("home") : homedir()
const budibaseDir = join(homeDir, ".budibase")
2020-07-14 05:11:19 +12:00
process.env.BUDIBASE_DIR = budibaseDir
2020-06-16 04:06:54 +12:00
2020-07-14 20:10:01 +12:00
fixPath()
2020-07-11 03:17:04 +12:00
require("dotenv").config({ path: resolve(budibaseDir, ".env") })
2020-06-16 04:06:54 +12:00
2020-06-16 04:08:59 +12:00
const server = await require("./app")()
2020-07-11 03:17:04 +12:00
2020-06-16 04:06:54 +12:00
server.on("close", () => console.log("Server Closed"))
console.log(`Budibase running on ${JSON.stringify(server.address())}`)
}
2020-06-16 04:08:59 +12:00
runServer()