mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-08 13:25:17 +00:00
add 2nd endpoint to webserver; use express
This commit is contained in:
parent
12354e5eab
commit
adc924df3e
1
lib/modules/webserver/backend/index.html
Normal file
1
lib/modules/webserver/backend/index.html
Normal file
@ -0,0 +1 @@
|
||||
Welcome to Embark!
|
@ -3,6 +3,8 @@ let http = require('http');
|
||||
let serveStatic = require('serve-static');
|
||||
const {canonicalHost, defaultHost, dockerHostSwap} = require('../../utils/host');
|
||||
require('http-shutdown').extend();
|
||||
var express = require('express');
|
||||
let path = require('path');
|
||||
|
||||
class Server {
|
||||
constructor(options) {
|
||||
@ -20,9 +22,16 @@ class Server {
|
||||
}
|
||||
let serve = serveStatic(this.dist, {'index': ['index.html', 'index.htm']});
|
||||
|
||||
this.server = http.createServer(function onRequest(req, res) {
|
||||
serve(req, res, finalhandler(req, res));
|
||||
}).withShutdown();
|
||||
var app = express();
|
||||
|
||||
app.use(serve);
|
||||
app.use('/backend', serveStatic(path.join(__dirname, 'backend'), {'backend': ['index.html', 'index.htm']}));
|
||||
|
||||
//app.get('/embark', function (req, res) {
|
||||
// res.send('Welcome to Embark')
|
||||
//});
|
||||
|
||||
app.listen(this.port);
|
||||
|
||||
let message = __("webserver available at") +
|
||||
" " +
|
||||
|
@ -43,6 +43,7 @@
|
||||
"eth-ens-namehash": "^2.0.8",
|
||||
"eth-lib": "^0.2.8",
|
||||
"ethereumjs-wallet": "0.6.0",
|
||||
"express": "^4.16.2",
|
||||
"file-loader": "^1.1.5",
|
||||
"finalhandler": "^1.1.1",
|
||||
"follow-redirects": "^1.2.4",
|
||||
|
Loading…
x
Reference in New Issue
Block a user