Merge pull request #9 from BinBashBanana/main

Better errors
This commit is contained in:
David Reed 2022-11-02 01:22:09 +00:00 committed by GitHub
commit 1f18066f52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

4
package-lock.json generated
View file

@ -2013,7 +2013,7 @@
},
"node_modules/ultraviolet-static": {
"version": "1.0.2",
"resolved": "git+ssh://git@github.com/titaniumnetwork-development/Ultraviolet-Static.git#97155032e6082a86d9f701bd1bd729fe3593e137",
"resolved": "git+ssh://git@github.com/titaniumnetwork-development/Ultraviolet-Static.git#298cc59dd54f4f3df5e36f41b149493d3a2ff092",
"peerDependencies": {
"ultraviolet": "https://github.com/titaniumnetwork-development/Ultraviolet/releases/download/v1.0.1/ultraviolet-1.0.1.tgz"
}
@ -3533,7 +3533,7 @@
}
},
"ultraviolet-static": {
"version": "git+ssh://git@github.com/titaniumnetwork-development/Ultraviolet-Static.git#97155032e6082a86d9f701bd1bd729fe3593e137",
"version": "git+ssh://git@github.com/titaniumnetwork-development/Ultraviolet-Static.git#298cc59dd54f4f3df5e36f41b149493d3a2ff092",
"from": "ultraviolet-static@github:titaniumnetwork-development/Ultraviolet-Static",
"requires": {}
},

View file

@ -3,6 +3,7 @@ import express from "express";
import { createServer } from "node:http";
import { publicPath } from "ultraviolet-static";
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
import { join } from "node:path";
const bare = createBareServer("/bare/");
const app = express();
@ -13,6 +14,12 @@ app.use(express.static(publicPath));
// The vendor's uv.config.js won't conflict with our uv.config.js inside the publicPath directory.
app.use("/uv/", express.static(uvPath));
// Error for everything else
app.use((req, res) => {
res.status(404);
res.sendFile(join(publicPath, "404.html"));
});
const server = createServer();
server.on("request", (req, res) => {