generated from azures04/Base-REST-API
Introduce bootstrap entrypoint and prestartup to ping DB and generate/manage RSA keypair. Add security module for key IO. Implement JWT-based access and refresh tokens (tokensService) with refresh_tokens table and repo. Add auth, provider and user services, and refresh-token management. Update repositories (users, credentials, providers, servers) with SQL fixes and new helper methods. Move DDL execution to bootstrap (remove from server). Update package.json main and add dependencies (bcryptjs, jsonwebtoken). Update .env.example and .gitignore accordingly.
17 lines
469 B
JavaScript
17 lines
469 B
JavaScript
const prestartup = require("./modules/prestartup")
|
|
const database = require("./modules/database")
|
|
const logger = require("./modules/logger")
|
|
|
|
async function boot() {
|
|
try {
|
|
await prestartup.pingDb()
|
|
await database.runDDL()
|
|
await prestartup.setupKeys()
|
|
require("./server")
|
|
} catch (error) {
|
|
logger.error("Error while booting", ["STARTUP", "cyan"])
|
|
logger.error(error.toString(), ["STARTUP", "cyan"])
|
|
}
|
|
}
|
|
|
|
boot() |