Launch an API in a local environment
Rework pending, no delivery date. The Front App SDK (ReactJS) and the Front API SDK (NodeJS) are both being replaced. This page documents the current release, remains accurate, and is maintained until the replacement ships. Code written against it keeps working.
While OVHcloud Data Platform is great as a tool for hosting deployed APIs during both development and production, itβs not always the natural place to edit code. Most software engineers prefer to edit their code on their computer.
Below is how you can build and deploy an API from a local development environment.
- 0) Requirements
- 1) Download and install locally
- 2) Launch the API
- 3) Manage authentication
- 4) Launch everything together
Requirements
NodeJS
Currently we use v10 in production, but we will soon update it to 14. In local, it will work with both versions, we recommend using v14 right now, but to keep a look on the functions used while the update is not done in production. Install it from here.
Redis (optional)
By default the API use Redis as cache in production It can be disable for dev, but you can also use a local redis
Install redis
If you want to have it locally, we recommand to install and use Docker. Then it is possible to:
or Disable cache
- Open "forepaas.json"
- Replace these occurence
by
- Remove the cache redis main occurence
Download and install locally
- From the GUI, go to the API Overview https://eu.dataplatform.ovh.net/#/api/\{ProjectID\}/\{API_NAME\}
- Select the tag you want to copy, then click on "Download that version"
- Extract the zip in a folder of your choice
- Install node dependencies (we use the package manager yarn by default, we recommend you to use the same to have same condition than production)
Launch the API
By default you should find a "run.sh" script, already here, giving a sample of quick run
- KONG_INTERNAL_URI: it will disable a production mode for URL computing, we plan to remove that variable in future
- FOREPAAS_APPLICATION_CREDENTIALS: used to link to a local
creds.jsonfile, it will be described below - FOREPAAS_QB_RESOURCE_ID: get legacy ACL resources
- REDIS_URI: if using a local redis, it should override the URL here, as explained in previous section (it should already be the correct value)
- ENV: set to
developmentfor local development yarn run start: it will launch the API, useyarn run watchto reload as soon as code is updated in local environement
If you launch the API, it should start well, but you will not be identify to the platform and your API will not be able to call the Project API. For this, you need to get authenticated.
Manage authentication
By default, in production on OVHcloud Data Platform, the API is self-authenticated to the other Project components. But when you are in a local development environment, you need to authenticate though the Identity Access Manager.
The best way to do it is by generating API and secret key for a user (or a service account). You will also need your Project subdomain.
Once you have the keys and project subdomain, you can create a file called "creds.json" at the root of the API. This file should never be committed (set in .gitignore by default).
Launch everything together
Launch your API by calling the "run.sh" file.
Go further
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.
Ask questions, give your feedback and interact directly with the team building the Data Platform on the dedicated Discord channel.
If you need support with your OVHcloud services, create a request in our Help Centre.
Join our community of users.

