Created
December 1, 2017 21:28
-
-
Save oshingc/cd46a200d0e4db5f9ecf661eb2867079 to your computer and use it in GitHub Desktop.
Node running Angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var compression = require('compression'); | |
var proxy = require('express-http-proxy'); | |
var session = require('express-session'); | |
var app = express(); | |
var user = {uid: 'user', name: 'user A', role: '[{"portal":"worker","roles":["app_worker]}]'}; | |
var proxySetting = { | |
forwardPath: function(req) { | |
return "/myintranet" + require('url').parse(req.url).path; | |
}, | |
limit: '2050mb', | |
decorateRequest: function (req) { | |
req.headers['uid'] = user.uid; | |
req.headers['first_name'] = user.name; | |
req.headers['roles'] = user.role; | |
return req; | |
} | |
}; | |
app.use("/myserver/", proxy("https://myserver.site.company.com", proxySetting)); | |
app.use(express.static('../buildapp/dist/client')); | |
//I go back one folder to put the Angular App location | |
//At client folder we have index.html of the Angular app | |
app.listen(8085, function () { | |
console.log('Example app listening on port 8085!') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "sst_home", | |
"version": "1.0.0", | |
"description": "", | |
"main": "app.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"compression": "^1.6.2", | |
"express": "^4.14.0", | |
"express-http-proxy": "^0.10.1", | |
"express-session": "^1.15.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment