Maintenance commit.

This commit is contained in:
Evert Prants 2020-05-29 11:25:49 +03:00
parent 4b92e46b57
commit bc204e333a
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 24 additions and 21 deletions

View File

@ -11,30 +11,30 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@babel/runtime": "^7.7.6", "@babel/runtime": "^7.10.1",
"bcrypt": "^3.0.7", "bcrypt": "^4.0.1",
"bluebird": "^3.7.2", "bluebird": "^3.7.2",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"connect-redis": "^3.4.2", "connect-redis": "^4.0.4",
"express": "^4.17.1", "express": "^4.17.1",
"express-async-errors": "^3.1.1", "express-async-errors": "^3.1.1",
"express-session": "^1.17.0", "express-session": "^1.17.1",
"fluent-ffmpeg": "^2.1.2", "fluent-ffmpeg": "^2.1.2",
"fs-extra": "^7.0.1", "fs-extra": "^9.0.0",
"oauth-libre": "^0.9.17", "oauth-libre": "^0.9.17",
"redis": "^2.8.0", "redis": "^3.0.2",
"request": "^2.88.0", "request": "^2.88.2",
"request-promise-native": "^1.0.8", "request-promise-native": "^1.0.8",
"socket.io": "^2.3.0", "socket.io": "^2.3.0",
"sqlite": "^3.0.3", "sqlite": "^4.0.9",
"sqlite3": "^4.1.1", "sqlite3": "^4.2.0",
"xml2js": "^0.4.22" "xml2js": "^0.4.23"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.7.5", "@babel/cli": "^7.10.1",
"@babel/core": "^7.7.5", "@babel/core": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.7.6", "@babel/plugin-transform-runtime": "^7.10.1",
"@babel/preset-env": "^7.7.6", "@babel/preset-env": "^7.10.1",
"morgan": "^1.9.1" "morgan": "^1.10.0"
} }
} }

View File

@ -1,11 +1,12 @@
import path from 'path' import path from 'path'
import sqlite from 'sqlite' import { open } from 'sqlite'
import Promise from 'bluebird' import sqlite3 from 'sqlite3'
const values = require(path.join(process.cwd(), 'values.json')) const values = require(path.join(process.cwd(), 'values.json'))
const dbPromise = Promise.resolve() const dbPromise = open({
.then(() => sqlite.open(path.join(process.cwd(), values.database), { Promise, cache: true })) filename: path.join(process.cwd(), values.database),
.then(db => db.migrate()) driver: sqlite3.cached.Database
})
export { dbPromise } export { dbPromise }

View File

@ -370,6 +370,8 @@ app.use('/', express.static(path.join(process.cwd(), 'public')))
const host = process.env.NODE_ENV === 'development' ? '0.0.0.0' : '127.0.0.1' const host = process.env.NODE_ENV === 'development' ? '0.0.0.0' : '127.0.0.1'
server.listen(port, host, function () { server.listen(port, host, async function () {
const db = await dbPromise
await db.migrate()
console.log(`app running on port ${port}`) console.log(`app running on port ${port}`)
}) })