TL;DR
A read-only public catalog can start as one web service. Return JSON on a known route, return 404 on unknown routes and test the hosted endpoint from outside your laptop.
- Use sample data anyone may read.
- Listen on the port supplied by the host.
- Add a database when changes must persist independently of a code release.
Run a public endpoint locally
Save this as server.mjs. The catalog is part of the deployed code. Updating these two items therefore requires a new release.
import { createServer } from "node:http";
const catalog = [{ id: "tent", name: "Tent" }, { id: "lamp", name: "Lamp" }];
createServer((req, res) => {
res.setHeader("Content-Type", "application/json");
if (req.method === "GET" && req.url === "/catalog") {
res.end(JSON.stringify(catalog));
return;
}
res.writeHead(404);
res.end(JSON.stringify({ error: "Route not found" }));
}).listen(Number(process.env.PORT || 8080), "0.0.0.0");
Run node server.mjs. In another terminal, run curl -i http://localhost:8080/catalog. Expect HTTP 200, a JSON content type and two items. Request /missing and expect 404. If all you need is a fixed file that changes with each release, serving a static JSON file is cheaper and simpler. A server becomes useful when you add custom request handling.
Put the service on floo
Save this as Dockerfile next to the server:
FROM node:24-alpine
WORKDIR /app
COPY server.mjs .
CMD ["node", "server.mjs"]
Ask your coding agent to read https://getfloo.com/agents.md and deploy this folder to dev on floo as one public web service on port 8080. Have it ask before creating paid resources. Explain that all catalog entries are public sample data and that the API needs no database or scheduled job yet.
Copy the dev URL returned by the agent. Append /catalog and open it on a phone. You should see the two items. Verify the missing route also returns 404 at the hosted URL. If you later want users to edit entries, put the mutable records in Postgres and require authorization on the write route before accepting real data. Compare hosting costs for a small app.