I am new to yoman and trying to get a basic site created by yoman that was deployed on an elastic beanstalk. The moment I deploy, I get 502: Bad Gateway. I can deploy a simple nodejs aws application 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 a port in the url, this page works fine. Not sure if this applies to this issue.
The process of using the yoman angular generator is pretty standard, i.e.
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 work with the corner application locally, from here I follow the same workflow that correctly used the previous hello world sample (commit to git repo, create an image using elastic beanstalk cli ....). I made a repo based on the contents of the / dist folder and deployed it where I got 502.
There are two conclusions that I have here, firstly, I should listen to port 80, although my previous sample: 8888 worked, so I believe that the following requirement is most relevant, that the file named server.js is in the root directory.
The output from the grunt \ dist assembly 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 that app.js is not part of the dist output, but now I have these 3 new js script files. What do I need to configure for the nodejs container to serve this new structure?
Here is 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 information.
Hooray!