Skip to content

Commit

Permalink
Merge pull request #7 from CountBleck/fixes
Browse files Browse the repository at this point in the history
Minification and more!
  • Loading branch information
GreenyDEV authored Sep 1, 2022
2 parents 05020a7 + 40e9a56 commit 5e7dde2
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 61,965 deletions.
13 changes: 9 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import createBareServer from '@tomphttp/bare-server-node';
import http from 'http';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import nodeStatic from 'node-static';
import serveStatic from 'serve-static';
import * as custombare from './static/customBare.mjs';

const PORT = process.env.PORT || 3000;
Expand All @@ -11,10 +11,10 @@ const bareServer = createBareServer('/bare/', {
localAddress: undefined
});

const serve = new nodeStatic.Server(join(
const serve = serveStatic(join(
dirname(fileURLToPath(import.meta.url)),
'static/'
));
), {fallthrough: false});

const server = http.createServer();

Expand All @@ -25,7 +25,12 @@ server.on('request', (request, response) => {
if (bareServer.shouldRoute(request)) {
bareServer.routeRequest(request, response);
} else {
serve.serve(request, response);
serve(request, response, err => {
response.writeHead(err?.statusCode || 500, null, {
"Content-Type": "text/plain"
})
response.end(err?.stack)
});
}
} catch (e) {
response.writeHead(500, "Internal Server Error", {
Expand Down
272 changes: 208 additions & 64 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
"scripts": {
"start": "node app.js"
},
"keywords": ["proxy"],
"keywords": [
"proxy"
],
"author": "Nebula Services",
"license": "MIT",
"dependencies": {
"@tomphttp/bare-server-node": "^1.0.2-beta-readme5",
"bare-server-node": "github:tomphttp/bare-server-node",
"crypto-js": "4.1.1",
"css-tree": "^2.1.0",
"node-fetch": "^3.2.6",
"node-static": "^0.7.11",
"ws": "^8.8.1",
"crypto-js": "4.1.1"
"serve-static": "^1.15.0",
"ws": "^8.8.1"
}
}
}
Loading

0 comments on commit 5e7dde2

Please sign in to comment.