Answer the question
In order to leave comments, you need to log in
Angular 2 how to override server from nodejs to apache(openServer) and comment sub-question?
Angular2 (build from the creators), when deployed, drags a lite server or some other, that's not the point.
Well, browserify, that's all. Comfortable, no doubt.
Explain, who knows, whether it is possible to redefine the server in such an assembly to php-shny, while maintaining browserify, and if so, how.
But another question is more important - if you do not do this (do not override), it turns out that such an application may not need a centralized server, and somehow you can think about the client-client architecture, throwing the (centralized) server out of this scheme as a link?
Answer the question
In order to leave comments, you need to log in
In essence, you need to inject a proxy inside your node server.
Separately, this is done somehow like this:
var http = require('http');
http.createServer(onRequest).listen(3000);
function onRequest(client_req, client_res) {
console.log('serve: ' + client_req.url);
var options = {
hostname: 'www.google.com',
port: 80,
path: client_req.url,
method: 'GET'
};
var proxy = http.request(options, function (res) {
res.pipe(client_res, {
end: true
});
});
client_req.pipe(proxy, {
end: true
});
}
http://127.0.0.1:3000/
in, you get a workable google. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question