HTTP functions

overview

Establish a bare-bones REST-API endpoint, called a HTTP function. We expose a regular REST API endpoint.

We respond with JSON, HTML, or plain text:

export const sayHello = onRequest((req, res) => {
    res.send("Hello from Firebase!")
})

add options

const options = {
    region: "europe-west1",
    cors: true,
}
export const sayHello = onRequest(options, (req, res) => {})

ExpressJS concepts and syntax

Req and res objects have the shape of expressJS req and res objects. We can add middleware.

call the endpoint: standard HTTP request (not firebase specific)

We read the function's URL at deploy time.

We consume endpoints like regular REST API endpoints. They URL that looks like this:

https://requestPlanet-x82jak2-ew.a.run.app
earlymorning logo

© Antoine Weber 2026 - All rights reserved

HTTP functions

overview

Establish a bare-bones REST-API endpoint, called a HTTP function. We expose a regular REST API endpoint.

We respond with JSON, HTML, or plain text:

export const sayHello = onRequest((req, res) => {
    res.send("Hello from Firebase!")
})

add options

const options = {
    region: "europe-west1",
    cors: true,
}
export const sayHello = onRequest(options, (req, res) => {})

ExpressJS concepts and syntax

Req and res objects have the shape of expressJS req and res objects. We can add middleware.

call the endpoint: standard HTTP request (not firebase specific)

We read the function's URL at deploy time.

We consume endpoints like regular REST API endpoints. They URL that looks like this:

https://requestPlanet-x82jak2-ew.a.run.app