Skip to content

enreeco/tc-api

 
 

Repository files navigation

TopCoder API (built on NodeJS)

As TopCoder and CloudSpokes integrate, the APIs are going to play a critical role. TopCoder has already started work on a API, which can be found here. That API is built on a Java stack.

In order to accelerate development we are looking to move some of the API work to use a more cloud-friendly approach built on NodeJS. This is complicated by the fact that the back end of TC relies on an Informix DB.

This code at the moment should be considered in a "Proof-of-concept" state, but we hope to rapidly bring it up into production readiness.

Configuration

Configuration at the moment is fairly messy.

Informix

  • sqlhosts - You need to configure a sqlhosts file to tell the Informix drivers about the Informix DB. Copy the example file, doc/sqlhosts.informixoltp_tcp. Change line 62 to point to the IP and Port of your Informix DB. Then put the file in thirdparty/ibm/informix/etc.
  • .procfile - This file loads all the Informix variables into the session. You should not have to change it, but be aware of it. When working locally you'll need to run it manually by executing . .profile in your terminal.
  • db_conf.json - This file is only used for logging. It should be removed as part fo configuration cleanup.

OAuth Configuration

  • config.js - This file has most of the values used by the oauth provider. clientID, clientSecret, are already setup for dev purposes. Change the callbackURL to use the domain/IP of where you will be running API code.
  • node_modules/passport-topcoder/lib/passport-topcoder/strategy.js - The OAuth provider URL is being set on lines 51 and 52, and is currently hardcoded to TopCoder's production OAuth provider. These values need to be moved up into general application configuration.

Running on Heroku

To run on Heroku, setup all the configuration as described above. Then follow the guide "Getting Started with Node.js on Heroku" with one additional step - after you create the application but before deploying it be sure to change your buildback as follows:

heroku config:set BUILDPACK_URL=https://github.com/cloudspokes/tc-api-heroku-buildpack.git

The reason is because we have to run the .profile before npm rebuild is called.

Hopefully we can eliminate the need for this by getting rid of the use of .profile.

About

TC node based API. Will be used for integration of CS and TC.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published