21 lines
399 B
JavaScript
21 lines
399 B
JavaScript
|
import Fastify from 'fastify';
|
||
|
import path from 'node:path';
|
||
|
import * as staticPlugin from '@fastify/static';
|
||
|
|
||
|
const fastify = Fastify({
|
||
|
logger: true
|
||
|
});
|
||
|
|
||
|
fastify.register(staticPlugin, {
|
||
|
root: path.join(import.meta.dirname, 'dist'),
|
||
|
prefix: '/site/',
|
||
|
})
|
||
|
|
||
|
try {
|
||
|
await fastify.listen({ port: 3000, host: 'site' });
|
||
|
} catch (err) {
|
||
|
fastify.log.error(err);
|
||
|
process.exit(1);
|
||
|
};
|
||
|
|