Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
How to add JOI validator to firebase function?

How to add JOI validator to firebase function as a middleware? I call firebase function like below:

exports.createUserAccount = region("europe-east1").https.onCall(createAccount); // createAccount is an function

in normal endpoints/routes in express i do something like this:

app.post("/app/some/endpoint", auth(), validator(), createAccount());

where my validator is an Joi middleware where I check that req.body is correct like a provided schema.

PS. I don't have an (req, res) in createAccount function, cause firebase return provided in this function an simple dto.

Thanks for any help

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use JOI middlewares on Firebase by exposing an Express app via HTTP triggered functions and via Callable functions.

onRequest and onCall both takes a function that will return a Promise. Starting from here, you can create an Express application, register any middleware you want, then pass the Express app to the onCall.

The way to create the Express app is greatly documented here. Note that there is a big difference between onRequest and onCall:

  • onRequest expose the whole Express app, so you can register routes and so on, and build a REST API using it;
  • onCall will wrap your Express app, because the SDK calls it with a POST request. It means you'll have to only accept one request on your Express app, mapping it to the root path and expecting a POST request.
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda