Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 1.7 KB

README.md

File metadata and controls

64 lines (41 loc) · 1.7 KB

typescript-amqp-hw

Simple AMQP Hello World! Node.js application in TypeScript prepared for Heroku deployment.

Deploy

RPC AMQP

The example responds with Hello World! message when a RPC message is sent to testQueue or bound testExchange.

Install

Follow the Heroku button to install the application to Heroku. The installation process should include the CloudAMQP add-on.

Set up and run locally

Node needs to be installed locally. Make sure the Heroku CLI is installed.

heroku git:clone -a <YOUR-APP-NAME>

It will be reported as an empty git repository, that's expected when deploying to Heroku from a Heroku Button click. To fix this, add the github remote and pull the source from it.

cd <YOUR-APP-NAME>
git remote add origin https://github.com/htutman/typescript-amqp-hw.git
git pull origin master

This will get the entire source code into the local git repository. To run locally the CLOUDAMQP_URL environment variable is needed with an URL to a AMQP server. To reuse the one provisioned on Heroku get the env var into .env file:

heroku config:get CLOUDAMQP_URL -s > .env

Run locally

npm i
npm run build
heroku local

Prettier

The project has prettier configured, to reformat code changes run:

npm run prettier

Pushing changes

Add all chenges to git. Push the commit to master branch of the heroku remote.

git add .
git commit -m "<Commit message>"
git push heroku master

On successful push Heroku automatically runs postinstall script from the package.json that builds JavaScript from TypeScript sources.