I'm new to yeoman and are trying to get a basic yeoman generated angularjs site deployed to elastic beanstalk. At the moment when I deploy I receive a 502: Bad Gateway. I am able to deploy a simple nodejs app to aws with something like
server.js
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(process.env.PORT || 8888);
Without specifying the port in the url, this page works fine. Not sure if that is relevant to this issue.
The process for using the yeoman angular generator is pretty standard ie.
yo angular
yo angular:controller testController
..add some directives / views etc..
grunt server -- serves up pages correctly on port 9000
grunt -- which creates the dist folder
At this stage I have a working angularjs app locally, from here I follow the same workflow that deployed the earlier hello world sample correctly ( commit to git repo, provision image with elastic beanstalk cli..etc..). I made a repo based on the contents of the /dist folder and deployed it where I get the 502..
There are 2 leads I have here, firstly I should be listening on Port 80 - although my earlier sample on :8888 worked so I think the next requirement is most relevant, which is A file named server.js in the root directory.
The grunt build output \dist contains:
bower_components
views
styles
scripts
25e920e4.modules.js
5e188624.scripts.js
76c21dca.plugins.js
So I'm not sure about the next step. I noticed the app.js is not a part of the dist output but now I have these 3 new script js files. What do I need to configure to make the nodejs container serve up this new structure?
Here's what the original app.js
'use strict';
angular.module('nodealphaApp', [])
.config(function ($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.otherwise({
redirectTo: '/'
});
});
Let me know if I can provide more info
Cheers!