Skip to content

Instantly share code, notes, and snippets.

@aaronksaunders
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronksaunders/3ebae9a8e511d7a167a7 to your computer and use it in GitHub Desktop.
Save aaronksaunders/3ebae9a8e511d7a167a7 to your computer and use it in GitHub Desktop.
Packaging up an Angular JS App to Run in Node.ACS Environment from Appcelerator

Deploying an AngularJS Application to node.acs

###Follow the instructions below these instructions assume you used Grunt to create the basic project structure and are packaging the app for deployment using grunt build:dist

  1. Enter the grunt command to build the application from project root grunt build:dist

  2. Enter the following commands to copy needed files to dist directory, this assumes you placed them in a folder called acs_deploy

    • cp acs_deploy/app.js dist/app.js
    • cp acs_deploy/package.json dist/package.json
  3. Login to acs, using your appcelerator credentials acs login

  4. Deploy app to acs using the following command acs publish -d . --force

The output from the publish command should provide you with a url where the application can be accessed from a web browser

Additional Information

Using node-static to create a small webserver which is used to serve the static pages of teh angular JS application. See the github repo fpr more information - https://github.com/cloudhead/node-static

{
"name": "simple-app-admin",
"version": "2.0.0",
"main": "app.js",
"engines" : { "node": ">=0.10.22" },
"framework": "none",
"bodyParser": true,
"preferGlobal": false,
"dependencies": {
"node-static" : "latest",
"http" : "latest",
},
"npmRegistry": "http://registry.npmjs.org/",
"license":"",
"private": true
}
var http = require('http'),
static = require('node-static');
//
// Create a node-static server instance to serve the '.', files are in the dist folder
//
var staticServer = new static.Server('.', {indexFile: "index.htm"});
http.createServer(function (request, response) {
staticServer.serve(request, response, function (err, res) {
if (err) { // An error as occured
console.error("> Error serving " + request.url + " - " + err.message);
response.writeHead(err.status, err.headers);
response.end();
} else { // The file was served successfully
console.log("> " + request.url + " - " + res.message);
}
});
}).listen(80);
console.log("started " + JSON.stringify(staticServer));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment