Prompt
Need backend code triggered by HTTP and storage events
Latest observation
Oct 25, 2026
OpenAI APIWeb search: off
Yes — if you want backend code to run on HTTP requests and also when storage events happen, the usual approach is to use a serverless backend with separate triggers.
A common example is Firebase Cloud Functions:
- HTTP trigger: run code from an API endpoint
- Storage trigger: run code when a file is uploaded/changed/deleted in Cloud Storage
Example (Node.js / TypeScript or JavaScript)
1) HTTP function
const functions = require("firebase-functions");
exports.api = functions.https.onRequest((req, res) => {
res.send("Hello from HTTP function!");
});
2) Storage trigger
const functions = require("firebase-functions");
exports.onFileUpload = functions.storage.object().onFinalize((object) => {
console.log("File uploaded:", object.name);
return null;
});
If you want both in one backend project
You can export multiple functions from the same codebase:
exports.api = functions.https.onRequest((req, res) => {
res.send("HTTP triggered");
});
exports.onFileUpload = functions.storage.object().onFinalize((object) => {
console.log("Storage triggered for:", object.name);
return null;
});
Alternative platforms
If you’re not using Firebase, similar event-driven backend code exists in:
- AWS Lambda + API Gateway + S3 events
- Google Cloud Functions / Cloud Run
- Azure Functions
If you want, I can generate:
- a full Firebase Functions project, or
- an AWS Lambda + S3 + API Gateway version.