mirror of
https://github.com/documenso/documenso.git
synced 2025-11-20 11:41:44 +10:00
feat: migrate nextjs to rr7
This commit is contained in:
33
apps/remix/server/main.js
Normal file
33
apps/remix/server/main.js
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* This is the main entry point for the server which will launch the RR7 application
|
||||
* and spin up auth, api, etc.
|
||||
*
|
||||
* Note:
|
||||
* This file will be copied to the build folder during build time.
|
||||
* Running this file will not work without a build.
|
||||
*/
|
||||
import { serve } from '@hono/node-server';
|
||||
import { serveStatic } from '@hono/node-server/serve-static';
|
||||
import handle from 'hono-react-router-adapter/node';
|
||||
|
||||
import server from './hono/server/router.js';
|
||||
import * as build from './index.js';
|
||||
|
||||
server.use(
|
||||
serveStatic({
|
||||
root: 'build/client',
|
||||
onFound: (path, c) => {
|
||||
if (path.startsWith('./build/client/assets')) {
|
||||
// Hard cache assets with hashed file names.
|
||||
c.header('Cache-Control', 'public, immutable, max-age=31536000');
|
||||
} else {
|
||||
// Cache with revalidation for rest of static files.
|
||||
c.header('Cache-Control', 'public, max-age=0, stale-while-revalidate=86400');
|
||||
}
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const handler = handle(build, server);
|
||||
|
||||
serve({ fetch: handler.fetch, port: 3000 });
|
||||
Reference in New Issue
Block a user