An Express API starter, ready to host

One dependency, four example routes, and the few things a hosted app has to get right, already done.

The starter's routes answering on its web address.
Terminal
$ curl https://my-api.fadehost.app/api/hello?name=Ada
{"hello":"Ada"}
$ curl https://my-api.fadehost.app/health
{"ok":true,"uptime":5021}
$ curl https://my-api.fadehost.app/api/visits
{"visits":3,"storedIn":"/data"}
Plan
Free to try
Dependencies
One: Express
Runtime
Node.js 20 or newer
Keeps
Files under /data

What is in it

Listens where it should

On PORT and 0.0.0.0. An app bound to localhost answers only itself, and its web address gets nothing.

A health route that means it

/health answers only once the app can really serve, for the health check or an uptime monitor.

Files that survive a redeploy

The app folder is cloned fresh on every deploy and /data is not. The visit counter proves it.

Errors and shutdowns handled

A 404 or a thrown error answers JSON without a stack trace, and SIGTERM lets requests in flight finish.

Set it up

  1. 1

    Make a copy

    Press Use this template on GitHub, or fork it.

  2. 2

    Deploy your copy

    Press Deploy free and pick your repository. Turn on the web address and the API answers at https://name.fadehost.app.

  3. 3

    Build on it

    Put your routes in app.js. Keep /health, the 0.0.0.0 bind and anything you cannot lose under /data. Every push redeploys it.

Routes

GET /
What the app is, and its routes.
GET /health
{ ok, uptime }
GET /api/hello?name=
{ hello: name }
POST /api/echo
Gives back the JSON you sent.
GET /api/visits
A counter kept under /data, to show it survives a redeploy.

Environment variables

They live in the table on the app's page in the panel, values masked once saved. Set for you means the panel fills it in when you deploy.

VariableNeededWhat it is
PORTSet for youThe port to listen on.
APP_URLSet for youThe public address, when the web address is on.
DATA_DIROptionalWhere to keep files: /data, or ./data where there is no /data.

Which plan it needs

The free plan runs it with an address that sleeps when idle, and the first request after a quiet spell waits a few seconds. An API other things depend on belongs on Starter.

Free

Recommended

$0

No card

  • 256 MB and a quarter of a CPU
  • The address sleeps when idle and wakes on the next visit
  • 1 GB of traffic a day

Starter

$2/mo

or $20 a year

  • Always awake, with 1 GB and a full vCPU
  • No traffic limit
  • A MySQL database included

Running more than one? Standard carries two bots or apps for $3 a month and Pro four for $6, on one bill with your game servers. Every plan

Frequently asked questions

Can I deploy it without a copy of my own?

Yes. In the panel, Host an app, then the Express API starter template runs ours as it is. You need your own repository once you want to change the code.

Does TypeScript work?

Yes. Add a build script and point the start script at its output: when the file the start script runs is not committed, the build runs on every deploy.

Where does a database go?

Paid apps include a MySQL database at no extra cost, and PostgreSQL, MongoDB and Redis sit on your private network as managed databases. For something small, SQLite in a file under /data works too.

Start your API from the starter

Your first app is free, with no card, and gets its own https address.

Use this template