fastify/fastify

How to separate api endpoints in google cloud.

Open

#4,670 opened on 2023年4月4日

GitHub で見る
 (10 comments) (0 reactions) (0 assignees)JavaScript (36,241 stars) (2,683 forks)batch import
documentationgood first issue

説明

You have already researched for similar issues?

  • Yes

What are you trying to achieve, or the steps to reproduce?

I am able to deploy my fastify server but it shows up as 'one' route as shown in image bellow. All the logs from diff api ends show up under the 'fastifyServer' function and the analytics is basically useless because its the call to the server and not individual api ends. (ignore the other functions such as makeUppercase etc; the fastifyServer function itself has about 10 api ends under it that are not showing up here..which is my issue.)

chrome_Kv5KmbwtN1

This is what the export section of the fastify server looks like.

...

f.register(defaultController, { prefix: "/" });
f.register(router, { prefix: "/api/v1" });

const fServer = async (request:any, reply:any) => {
  await f.ready();
  f.server.emit("request", request, reply);
};

const fastifyServer =  functions.https.onRequest(fServer);
export default fastifyServer;

What was the result you received?

chrome_Kv5KmbwtN1

What did you expect?

All my fastify routes to be separate in the form of grouped export i.e {firebaseServer}-{api-path-end} for example for a user get route I was expecting to see something like firebaseServer-api-v1-user https://firebase.google.com/docs/functions/organize-functions#group_functions OR To be able to name them in the code during export so that they show up correctly

Context

  • node version: v16.13.2
  • fastify version: >=^4.15.0
  • os: Windows

コントリビューターガイド