Search code examples
web-servicesibm-cloudcontinuous-delivery

How to host webservice on bluemix?


I have an HTTP service written in Node.js

var server = http.createServer(function(request,response) {...}); server.listen(listenerPort);

When I deploy to Bluemix how/where do I assign a public endpoint and port#?


Solution

  • When you are ready to deploy to Bluemix you can use the PORT environment variable accessible by using process.env.PORT. There is also a npm package to help you with parsing Cloud Foundry environment variables like PORT

    To decide the host name for your application- The app name will be the default host name. for example cf push myapp will assign you the url myapp.mybluemix.net

    You can also assign a host name using the host key in your manifest.yml OR using cf push myapp -n myhostname