We use Fly.io internally for providing custom domain support to our customers. As we built our product, I put together a Node.js API client for Fly. I realized that it could be easily modified and then published publicly for others to use. And that’s what I just did!
The API client is pretty simple and allows you to do some basic things such as creating, deleting, or getting app hostnames.
const Fly = require("@filiosoft/fly");
const fly = new Fly("your-access-token");
const hostnames = await fly.getHostnames('example-app')
// responds with an array of the hostnames
const response = await fly.postHostname('example-app', 'example.com')
// responds with a preview_hostname
We have released this simple library under the MIT license so that you can use it in your project! You can find the full documentation for the library here, Fly’s API docs here, and the source code on GitHub.