mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-12 23:26:39 +00:00
add 2nd endpoint to webserver; use express
This commit is contained in:
parent
bcffa62294
commit
d03139b93d
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) {
|
||||
@ -25,15 +27,29 @@ 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);
|
||||
|
||||
this.logger.info(__("webserver available at") +
|
||||
" " +
|
||||
("http://" + canonicalHost(this.hostname) +
|
||||
":" + this.port).bold.underline.green);
|
||||
this.server.listen(this.port, this.hostname);
|
||||
|
||||
//this.server = http.createServer(function onRequest(req, res) {
|
||||
// serve(req, res, finalhandler(req, res));
|
||||
//}).withShutdown();
|
||||
|
||||
//this.logger.info("webserver available at " + ("http://" + this.hostname + ":" + this.port).bold.underline.green);
|
||||
//this.server.listen(this.port, this.hostname);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
@ -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