Extra contents beyond WaniKani
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

29 lines
598 B

import fastifyStatic from '@fastify/static';
import fastify from 'fastify';
import { fastifyRenderRouter } from '../renderer/fastify';
import { getPath, isDev, port } from './shared';
const IS_PRERENDER = true;
export async function fastifyServer() {
const app = fastify({
logger: {
prettyPrint: isDev,
},
});
if (isDev || !IS_PRERENDER) {
app.register(fastifyRenderRouter, { isProduction: !isDev });
} else {
app.register(fastifyStatic, {
root: getPath('dist/client'),
});
}
app.listen(port);
}
if (require.main === module) {
fastifyServer();
}