"make it work" .-.
This commit is contained in:
parent
a1e55230e1
commit
07228ac1f4
|
@ -1,3 +0,0 @@
|
|||
MONGO_URI = "A URI to the mongodb database."
|
||||
PORT = 12345
|
||||
LOAD_DB = true | false
|
12
index.js
12
index.js
|
@ -10,12 +10,23 @@ import njk from 'nunjucks'
|
|||
|
||||
import initLog from './libs/utils/log.js'
|
||||
import routes from './routes/routes.js'
|
||||
import api from './api/api.js'
|
||||
|
||||
import { generateDB } from './libs/database/generate.js'
|
||||
import { dbInit } from './libs/database/init.js'
|
||||
import { downloadEssentialData } from './libs/download/dowload.js'
|
||||
|
||||
const log = initLog("[ MAIN ]")
|
||||
|
||||
// Read the .env file
|
||||
dotenv.config()
|
||||
|
||||
if (process.env.DOWNLOAD_FILES === "true")
|
||||
await downloadEssentialData()
|
||||
|
||||
dbInit()
|
||||
generateDB()
|
||||
|
||||
const Server = express()
|
||||
|
||||
njk.configure(
|
||||
|
@ -29,6 +40,7 @@ njk.configure(
|
|||
)
|
||||
|
||||
Server.use('/', routes)
|
||||
Server.use('/api', api)
|
||||
Server.use('/assets', express.static('static'))
|
||||
|
||||
Server.listen(process.env.PORT ?? 12345, () => log(`Server started and listening on port ${process.env.PORT}.`))
|
||||
|
|
|
@ -162,7 +162,7 @@ export function generateDB() {
|
|||
log("Generating map index...")
|
||||
execMany([
|
||||
`CREATE INDEX IF NOT EXISTS "idx_maps_map" ON "maps" ("map")`,
|
||||
`CREATE INDEX IF NOT EXISTS "idx_maps_category" ON "maps" ("category")`
|
||||
`CREATE INDEX IF NOT EXISTS "idx_maps_category" ON "maps" ("category")`,
|
||||
`CREATE INDEX IF NOT EXISTS "idx_maps_categoryMap" ON "maps" ("category", "map")`
|
||||
])
|
||||
|
||||
|
|
|
@ -18,12 +18,10 @@
|
|||
"license": "WTFPL",
|
||||
"dependencies": {
|
||||
"@msgpack/msgpack": "^2.7.1",
|
||||
"better-sqlite3": "^7.4.4",
|
||||
"dotenv": "^10.0.0",
|
||||
"express": "^4.17.1",
|
||||
"mongoose": "^6.0.11",
|
||||
"nunjucks": "^3.2.3",
|
||||
"sqlite": "^4.0.23",
|
||||
"sqlite3": "^4.2.0"
|
||||
"nunjucks": "^3.2.3"
|
||||
},
|
||||
"nodeVersion": "system"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user