Simple Express server with "Hello world"
This commit is contained in:
parent
f8b9e20cb8
commit
e937c8ffc5
|
@ -4,6 +4,7 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"app-root-path": "^3.0.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-ws": "^4.0.0",
|
"express-ws": "^4.0.0",
|
||||||
"heroku-ssl-redirect": "^0.0.4",
|
"heroku-ssl-redirect": "^0.0.4",
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
const appRoot = require("app-root-path");
|
||||||
|
const express = require("express");
|
||||||
|
const sslRedirect = require("heroku-ssl-redirect");
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const host = process.env.HOST || "localhost";
|
||||||
|
const port = parseInt(process.env.PORT) || 6119;
|
||||||
|
|
||||||
|
app.use(sslRedirect());
|
||||||
|
app.use("/", express.static(appRoot + "/static"));
|
||||||
|
|
||||||
|
app.listen(port, host, () =>
|
||||||
|
console.log(`Listening on http://${host}:${port}`)
|
||||||
|
);
|
|
@ -0,0 +1,10 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>Fast Sandbox</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Hello, world!
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -10,6 +10,11 @@ accepts@~1.3.7:
|
||||||
mime-types "~2.1.24"
|
mime-types "~2.1.24"
|
||||||
negotiator "0.6.2"
|
negotiator "0.6.2"
|
||||||
|
|
||||||
|
app-root-path@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-3.0.0.tgz#210b6f43873227e18a4b810a032283311555d5ad"
|
||||||
|
integrity sha512-qMcx+Gy2UZynHjOHOIXPNvpf+9cjvk3cWrBBK7zg4gH9+clobJRb9NGzcT7mQTcV/6Gm/1WelUtqxVXnNlrwcw==
|
||||||
|
|
||||||
array-flatten@1.1.1:
|
array-flatten@1.1.1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
|
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
|
||||||
|
|
Loading…
Reference in New Issue