mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-06 04:22:07 +00:00
feat: improve performance
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import express from 'express';
|
||||
import compression from 'compression'
|
||||
import { sitemap } from './sitemap.js'
|
||||
import { createApp, fromNodeMiddleware, toNodeListener } from 'h3';
|
||||
import { createServer } from 'node:http';
|
||||
import { handler } from '../build/handler.js';
|
||||
import { sitemap } from './sitemap.js';
|
||||
|
||||
async function main() {
|
||||
const app = express();
|
||||
app.use(compression());
|
||||
app.use(await sitemap());
|
||||
app.use(handler);
|
||||
app.listen(3000, () => {
|
||||
console.log('Listening on http://0.0.0.0:3000');
|
||||
const port = process.env.PORT || 3000;
|
||||
const app = createApp();
|
||||
app.use('/sitemap.xml', await sitemap());
|
||||
app.use(fromNodeMiddleware(handler));
|
||||
const server = createServer(toNodeListener(app)).listen(port);
|
||||
server.addListener('listening', () => {
|
||||
console.log(`Listening on http://0.0.0.0:${port}`);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user