mirror of
https://github.com/hanzoai/runtime.git
synced 2026-10-30 18:23:13 +00:00
Signed-off-by: Toma Puljak <[email protected]> Signed-off-by: MDzaja <[email protected]> Co-authored-by: MDzaja <[email protected]>
23 lines
581 B
JavaScript
23 lines
581 B
JavaScript
import express from 'express'
|
|
|
|
import { handler as ssrHandler } from '../dist/server/entry.mjs'
|
|
import { env } from './util/environment.mjs'
|
|
|
|
const app = express()
|
|
app.use(express.json())
|
|
app.use((req, res, next) => {
|
|
res.setHeader('X-Frame-Options', 'SAMEORIGIN')
|
|
next()
|
|
})
|
|
app.use('/', express.static('dist/client/'))
|
|
app.use((req, res, next) => {
|
|
ssrHandler(req, res, next)
|
|
})
|
|
app.get('*', (req, res) => {
|
|
res.sendFile('404.html', { root: 'dist/client/' })
|
|
})
|
|
|
|
app.listen(env.FUNCTIONS_PORT, () => {
|
|
console.log(`Functions available on port ${env.FUNCTIONS_PORT}`)
|
|
})
|