forked from nasa-gcn/gcn.nasa.gov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.ts
22 lines (18 loc) · 762 Bytes
/
server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { type RequestHandler, createRequestHandler } from '@remix-run/architect'
import * as build from '@remix-run/dev/server-build'
import { installGlobals } from '@remix-run/node'
import sourceMapSupport from 'source-map-support'
sourceMapSupport.install()
installGlobals({ nativeFetch: true })
const remixHandler = createRequestHandler({
build,
mode: process.env.NODE_ENV,
})
const { CDN_SECRET } = process.env
export const handler: RequestHandler = (event, ...args) => {
if (CDN_SECRET && event.headers['x-cdn-secret'] !== CDN_SECRET)
// FIXME: this shouldn't need to be a promise.
// See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69466
return Promise.resolve({ statusCode: 502 })
return remixHandler(event, ...args)
}