Trying to run Aurelia.js in a Node.js and Express environment - Part 1
Trying to run Aurelia.js in a Node.js and Express environment - Part 2
Trying to run Aurelia.js in a Node.js and Express environment - Part 3
Trying to run Aurelia.js in a Node.js and Express environment - Part 4
Trying to run Aurelia.js in a Node.js and Express environment - Part 5
This time, we'll try using Heroku as a free cloud application platform.
Installing heroku-toolbelt
⇒ Download from https://toolbelt.heroku.com/
Download and install Heroku's client tool, heroku-toolbelt, from the link above. This will enable various Heroku commands on your command prompt.
※ I believe Git is included in heroku-toolbelt, but I'm not certain, so you may need to install it if it doesn't work.
Preparing the Procfile
Create a Procfile (no extension) to define the Heroku server's executable file. Place it in the root folder. This time, we will execute the Express startup file.
web: node app.js.gitignore Configuration
Configure your project so that only executable files, such as bundled files, can be deployed.
jspm can be run on the server side, but since we've bundled everything this time, we've configured it not to be processed by the server.
For this reason, I created a `core` folder and copied the `system.js`-related files from `jspm_packages` into it.
I also changed the file path to `system.js` within `index.html`.
Create a `.gitignore` file to specify folders and files to be ignored by Git.
# ignore
/*
# not ignore
!/core
!/dist
!/routes
!/styles
!/views
!/.gitignore
!/.npmignore
!/app.js
!/config.js
!/favicon.ico
!/package.json
!/ProcfileSince there were many files to ignore, I ignored everything first and then unignored the necessary ones.
Deploying Files to Heroku
Git Initialization
Open the command prompt and navigate to the Aurelia.js folder you created.
cd C:\project\aurelia-testgit initLogging in to Heroku
heroku loginLog in with the email and password you registered with Heroku.
Local Operation Check
heroku local webCreating a Heroku Application
Create an empty application. This can be done either via the command line or from the Heroku website.
heroku create myappnameChecking Git
Check if your Git remote settings are connected to your Heroku application.
git remote -vheroku https://git.heroku.com/myappname.git (fetch)
heroku https://git.heroku.com/myappname.git (push)If it's not connected, run the following command to set up the Git remote.
heroku git:remote -a myappnamePushing Files with Git
Push the files to Heroku. This completes the deployment.
git add .
git commit -m "my first commit"
git push heroku masterCommit the indexed files. The `-m` flag is used to add a comment. If you don't provide a comment with `-m`, a text editor will open, prompting you for one.
Heroku will build the application based on `package.json`.
Packages listed in `dependencies` will be installed.
You can confirm this by accessing the following URL. You can also check your app and change settings from the Heroku website.
https://myappname.herokuapp.com/※ If you want to run files that are not bundled by `gulp bundle`, you will need to modify your `.gitignore` settings. The `.gitignore` file described here is for cases where only bundled files are handled.
📦