Use this template to start a new API wrapper in the format of a ColdBox module.
- Clone this repo
- Wipe the
.git/directory and reinit git -rm -rf .git && git init - Replace
@MODULE_SLUG@with your module slug, i.e.cfynab - Replace
@MODULE_NAME@with your module name, i.e.cfYNAB - Replace
@API_NAME@with the name of the API in uppercase, i.e.STRAVA - Replace
@GITHUB_USER@with your github user name, i.e.michaelborn - Create a new github repository
- Configure the following secrets in the github repository:
FORGEBOX_TOKEN- grab this from your Forgebox profileGH_TOKEN- grab this from your Github Developer settings@API_NAME@_API_KEY- Used for github actions tests.@API_NAME@_API_KEY=mySecretKey@API_NAME@_API_URL- Used for github actions tests.@API_NAME@_API_URL=https://sandbox.finnhub.io/api/v1
- Code, test, and push to a github repository to use the github actions build.
- Profit. 💰
- Github Actions configuration
- Run
cfformatfor consistent cfscript syntax - Run module unit tests
- Release new module versions using Semantic Release
- Run
Wraps the @MODULE_NAME@ API for easy CFML usage using the Hyper ColdBox module.
- Install this module -
box install @MODULE_NAME@ - Configure @MODULE_NAME@ API secrets using
.env - OR configure @MODULE_NAME@ API via ColdBox
moduleSettings
@MODULE_NAME@ can mainly be configured using environment variables:
@API_NAME@_API_KEY- Required API key for authenticating with the @MODULE_NAME@ API@API_NAME@_API_URL- base URL of the @MODULE_NAME@ API.
You'll need to either use commandbox-dotenv to automatically populate environment variables from the .env file on server start, or manually read this file to populate environment variables inside your application.
# .env file
# @MODULE_NAME@ API Credentials
@API_NAME@_API_KEY=
@API_NAME@_API_URL=https://@MODULE_SLUG@.io/api/v1Set this in config/ColdBox.cfc in the configure() method:
moduleSettings.@MODULE_SLUG@ = {
apiKey : "blablasecret",
apiURL : "my.url"
};