更新圖示與部署更新機制並整理 README
This commit is contained in:
@@ -9,6 +9,8 @@ const app = express()
|
||||
const port = Number(process.env.PORT ?? process.env.SERVER_PORT ?? 8788)
|
||||
const matchTableName = process.env.DB_TABLE ?? 'badminton'
|
||||
const historyTableName = process.env.DB_HISTORY_TABLE ?? 'history'
|
||||
const appVersion = process.env.APP_VERSION ?? `${Date.now()}`
|
||||
const appStartedAt = new Date().toISOString()
|
||||
|
||||
const currentFilePath = fileURLToPath(import.meta.url)
|
||||
const currentDir = path.dirname(currentFilePath)
|
||||
@@ -37,6 +39,8 @@ app.use(express.json())
|
||||
|
||||
app.get('/api/health', (_request, response) => {
|
||||
response.json({
|
||||
appStartedAt,
|
||||
appVersion,
|
||||
ok: true,
|
||||
dbReady: Boolean(pool),
|
||||
distReady,
|
||||
@@ -46,6 +50,21 @@ app.get('/api/health', (_request, response) => {
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/api/version', (_request, response) => {
|
||||
response.set({
|
||||
'Cache-Control': 'no-store, no-cache, must-revalidate, proxy-revalidate',
|
||||
Expires: '0',
|
||||
Pragma: 'no-cache',
|
||||
'Surrogate-Control': 'no-store',
|
||||
})
|
||||
|
||||
response.json({
|
||||
ok: true,
|
||||
startedAt: appStartedAt,
|
||||
version: appVersion,
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/api/match-results/:time', async (request, response) => {
|
||||
if (!pool) {
|
||||
response.status(500).json({
|
||||
|
||||
Reference in New Issue
Block a user