update migration scripts + update healthcheck + bump version
This commit is contained in:
parent
b4e185d297
commit
241b1b1f47
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"private": true,
|
||||
"homepage": "https://github.com/movie-web/backend",
|
||||
"engines": {
|
||||
|
@ -15,7 +15,9 @@
|
|||
"build:pre": "rimraf dist/",
|
||||
"build:compile": "tsc && tsc-alias",
|
||||
"preinstall": "npx -y only-allow pnpm",
|
||||
"migration:create": "npx -y mikro-orm migration:create"
|
||||
"migration:create": "npx -y mikro-orm migration:create",
|
||||
"migration:up": "npx -y mikro-orm migration:up",
|
||||
"migration:down": "npx -y mikro-orm migration:down"
|
||||
},
|
||||
"mikro-orm": {
|
||||
"useTsNode": true,
|
||||
|
|
|
@ -5,13 +5,17 @@ import { makeRouter } from '@/services/router';
|
|||
export const metaRouter = makeRouter((app) => {
|
||||
app.get(
|
||||
'/healthcheck',
|
||||
handle(async ({ em }) => {
|
||||
handle(async ({ em, res }) => {
|
||||
const databaseConnected = await em.config
|
||||
.getDriver()
|
||||
.getConnection()
|
||||
.isConnected();
|
||||
|
||||
const healthy = databaseConnected;
|
||||
if (!healthy) res.status(503);
|
||||
|
||||
return {
|
||||
healthy: databaseConnected,
|
||||
healthy,
|
||||
databaseConnected,
|
||||
};
|
||||
}),
|
||||
|
|
Loading…
Reference in New Issue