hasurafix
This commit is contained in:
@@ -18,7 +18,7 @@ import 'dotenv/config'
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
const PORT = Number(process.env.PORT) || 3000
|
||||
const SECRET = (process.env.HASURA_ADMIN_SECRET || '').trim()
|
||||
const SECRET = (process.env.HASURA_ADMIN_SECRET || 'nearle-admin-secret').trim()
|
||||
const TARGET_LEGACY = 'https://api.workolik.com'
|
||||
const TARGET_REST = 'https://jupiter.nearle.app'
|
||||
|
||||
@@ -57,6 +57,12 @@ app.use('/live', createProxyMiddleware({
|
||||
pathRewrite: (p) => '/live' + p
|
||||
}))
|
||||
|
||||
app.use('/v1', createProxyMiddleware({
|
||||
...commonProxyOptions,
|
||||
target: TARGET_LEGACY,
|
||||
pathRewrite: (p) => '/v1' + p
|
||||
}))
|
||||
|
||||
// Built React app
|
||||
const distDir = path.join(__dirname, 'dist')
|
||||
app.use(express.static(distDir))
|
||||
@@ -68,5 +74,6 @@ app.listen(PORT, () => {
|
||||
console.log(`[xpress-docs] listening on http://localhost:${PORT}`)
|
||||
console.log(`[xpress-docs] proxying /api/* -> ${TARGET_LEGACY}/api/*`)
|
||||
console.log(`[xpress-docs] proxying /live/* -> ${TARGET_REST}/live/*`)
|
||||
console.log(`[xpress-docs] proxying /v1/* -> ${TARGET_LEGACY}/v1/*`)
|
||||
console.log(`[xpress-docs] admin secret: ${SECRET ? 'loaded' : 'NOT SET'}`)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user