Oracle Application Container Cloud service allows for microservices to be hosted using programming languages like Java SE, NodeJS, PHP and Python. Future plans include support for Ruby. An earlier post provided an overview and compared this to Oracle Container Cloud Service.
The applications run in a Docker container behind the scenes and is expected to expose a service port. By configuring metadata, access can be setup to other Oracle Cloud services like database, storage, messaging etc.
In this blog, we’ll build a weather microservice that will publish weather results for Melbourne. The weather data is retrieved from openweathermap and presented to the consumer as JSON. As the free plan allows for a maximum 2000 requests per day, this microservice will cache the result in memory and schedule weather updates every 2 hours.
First, install node v6 (to match the Oracle version) and ensure that the installed folder has been added to the PATH environment variable. While any text editor may be used to write code, Atom with script package installed was used so that code can be run directly in the editor.
Normally, the folder containing the NodeJS code is initialised using npm init. The resulting package.json will store the name of the package, version and dependencies for its execution.
The dependencies are initialised using npm install with the --save flag updating the package.json to store the dependencies. Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.