Node.js & REST API
This is a simple Node.js application that uses Express.js to create a REST API. It has two endpoints: one that returns a status message, and another that fetches and returns average interest rates data from the U.S. Department of the Treasury's Fiscal Data API.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY.
defang config set API_KEYDeployment
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
Title: Node.js & REST API
Short Description: A simple Node.js application that creates a REST API and fetches data from the U.S. Department of the Treasury's Fiscal Data API.
Tags: Node.js, REST API, JavaScript
Languages: nodejs