Merge branch 'master' of https://github.com/polarisdevs/Polaris
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
import express from 'express';
|
||||
import * as url from 'url';
|
||||
import * as path from 'node:path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const app = express();
|
||||
const port = process.env.port || 8080;
|
||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
||||
const port = process.env.PORT || 8080;
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
|
||||
app.use(express.static(path.join(__dirname, '/static'), { extensions: ['html'] }));
|
||||
app.use((req, res) => res.status(404).sendFile(path.join(__dirname, './static/', '404.html')));
|
||||
app.use(express.static(join(__dirname, '/static'), { extensions: ['html'] }));
|
||||
|
||||
app.use((req, res) => res.status(404).sendFile(join(__dirname, './static/', '404.html')));
|
||||
|
||||
// Error handling middleware
|
||||
app.use((err, req, res, next) => {
|
||||
console.error(err.stack);
|
||||
res.status(500).send('Something broke!');
|
||||
});
|
||||
|
||||
const server = app.listen(port, () => {
|
||||
console.log(`Polaris is running on port ${server.address().port}, using nodejs ${process.version}`);
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user