Questions tagged [fastify]

Fast and low overhead web framework for Node.js (https://www.fastify.io)

Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express.

The official website of Fastify is www.fastify.io. The source can be found on GitHub.

Useful links:

Older versions

671 questions
0
votes
0 answers

Unable to implement singleton patten in javascript

I am trying to implement a singleton pattern for the fastify instance. My code is as follows :- const { createFastifyServer: server } = require("../app"); const getFastifyInstance = (() => { let fastify; return { fastifyInstance: async ()…
Tanmaya
  • 570
  • 1
  • 4
  • 10
0
votes
0 answers

nodejs web application in k8s gets OOM

I'm running a nestjs web application implemented with fastify on kubernetes. I split my application into Multi Zones, and deploy it into different pyhsical location k8s clusters (Cluster A & Cluster B). Everything gose well, except the Zone X in…
0
votes
0 answers

How to download excel files in fastify?

This is my API response Currently, I'm using "node-excel-export" package for downloading. It is converted to excel format but the download functionality is not working. Here is my code var specification = { ASSIGNED_TO: { …
0
votes
1 answer

Formats to use on a response with fast-json-stringify

What I want to do is add validation to the schema response from a fastify route. Following the documentation from Fastify here we can see this Ajv for the validation of a request fast-json-stringify for the serialization of a response's…
jmanuelrosa
  • 307
  • 4
  • 12
0
votes
1 answer

fastify fail to serialize response schema with fluent json schema FST_ERR_SCH_SERIALIZATION_BUILD data.properties should be object

this is my route app.patch( `/${root}/item/:itemId`, { schema: item_schema, }, items // controller ); and this is my schema file import schema from "fluent-json-schema"; const body = schema .object() .prop( "itemTitle", …
ponez
  • 1
  • 3
0
votes
1 answer

Cookies with CORS

I have a frontend running on AWS and a backend on Heroku. As such, users access a login page on AWS, make a request to login via the API on Heroku, and should get a cookie back with a session id. I have read all about CORS and even CORS + cookies,…
0
votes
1 answer

Nodejs fastify crash heruku api

I'm trying to load a simple api written with nodejs and fastify, as seen in the code below. When I try to open the page I get such an error in the logs, and the page gives me Application error. Can you give me a hand? at=error code=H10 desc="App…
Paul
  • 3,644
  • 9
  • 47
  • 113
0
votes
1 answer

How to pass file or directory path as a REST API parameter to Fastify endpoint

Actually the question is in the header. A REST endpoint definition is below: fastify.get('/dir/:path', async (request, reply) => { let res = await remote.getDir(request.params.path); return { res: res }; }); And a call is…
Dmitry
  • 727
  • 1
  • 8
  • 34
0
votes
1 answer

Node.js Oracle Database Connection Pool Size

I implemented a connection pool (poolMin=poolMax=10) with node-oracledb and i saw a difference of up to 100 times especially in case of few users like 10. Really impressive. I also increased UV_THREADPOOL_SIZE like 4 + poolMax. At this point I could…
LacOniC
  • 824
  • 12
  • 21
0
votes
1 answer

fastify-mysql connecting to multiple databases

How do I connect to multiple mysql databases using fastify-mysql plugin? I have a file mysql.db.js in the plugins folder. But can't seem to figure out how to make multiple connections to 2 dbs residing in different locations. 'use strict' const fp…
oprogfrogo
  • 2,005
  • 5
  • 31
  • 42
0
votes
1 answer

How to upload a backup File to a fasitfy server?

I want to upload a file to fastify server,How could I do? There are some relative modules: fastify-file-upload fastify-multipart ...
radiorz
  • 1,459
  • 4
  • 18
  • 36
0
votes
1 answer

Fastify prettyPrint log in local time?

I've figured out how to pretty-print the logs in fastify: const server = fastify({ logger: { prettyPrint: __DEV__ && { translateTime: 'h:MM:ss TT', colorize: true, ignore: 'pid,hostname' }, …
mpen
  • 272,448
  • 266
  • 850
  • 1,236
0
votes
1 answer

What is the best way to transfer the nested JSON data of a HTTP response into a SQL database?

I am creating an API with Node.js, Fastify and Postgresql, this is supposed to get the data of a form from a yet to be developed React client, I imagine the structure of the data that will eventually arrive in my API as follows: { "quote": { "body":…
ambrecht-web
  • 57
  • 1
  • 6
0
votes
1 answer

How to minify your nodejs project and delete the Comment?

I'm writing a Node.js project. How can I protect it for being copied or read? Are there any tools to minify/uglify/compress my nodejs code? Should I use tools to turn the project into binary files so that the code can't be read? I want to delete…
radiorz
  • 1,459
  • 4
  • 18
  • 36
0
votes
2 answers

TypeError: app.address is not a function using chai-http

I'm trying to create a micro-api with Fastify and now I'm testing the app but I get this error: Testing /allstyles Should return all style names: TypeError: app.address is not a function at serverAddress…
Ming Ye
  • 33
  • 3