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

502 Proxy Error Node.js when using rackspace

Using pkgcloud to upload file to Rackspace Cloud files causing Request Timeout and then 502 error happens makes server unusable (stopped) but not crash. My Code : function processImage(req, reply) { const options = {} let imageName = null let…
mandaputtra
  • 922
  • 3
  • 18
  • 36
0
votes
1 answer

After I getting a set-cookie in response, is not saved and transmitted in requests

Basically after an auth, I setting a cookie, but apparently after page refresh on the cookie that was set by cloudflare is saved And the cookie that I transmitted with set-cookie is not used in after set-cookie requests # Response headers HTTP/2.0…
Anonymous
  • 69
  • 12
0
votes
1 answer

Error using fastify-multer to upload images

I am trying to use the fastify-multer plugin to upload files to the server and I am able to successfully get the images uploaded to the folder. The problem is my app crashes. I used the fastify-cli generated structure and I am running it as a…
0
votes
1 answer

How to get random mongodb documents using aggregate() and $sample?

I am trying to get 2 random documents within a collection called 'templates' but I only get an Internal Server Error. I have successfully tested the following code in the mongo shell: db.templates.aggregate([{"$sample":{"size":2}}]) Could there…
Taaaz1964
  • 1
  • 4
0
votes
1 answer

ObjectionJS - Group models in a data layer file

I have a NodeJS app running fastify with fastify-objectionjs. For tidiness, I'd like to group all models in a single file called _main.js, where I export an array of the models inside the models folder. Since the fastify-objectionjs registration…
GigiSan
  • 1,170
  • 2
  • 19
  • 30
0
votes
1 answer

Result perf node using mongo nestJs or fastify

I have made two projects, one using nestJS/mongoDB and the other Fastify/MongoDB in order to compare performance of both frameworks. I made a simple get resource API querying a mongo document having ~400Kb. Both projects route responds with the JSON…
kyserslick
  • 591
  • 1
  • 10
  • 27
0
votes
1 answer

How to mock this method?

I want to mock the below line of code. And please explain how I can mock this in detail as I'm new to javascript and writing test cases. The below code would return a promise. const createPriceConfiguration = (fastify, req) => { return…
vi ghd
  • 1
0
votes
1 answer

Couldn't catch(construct) the right router

I read https://github.com/fastify/fastify/blob/master/docs/Routes.md But my router doesn't seems to catch the right url with params Url : /app/name?id=666&method=3&_=1553342444710 I tried: fastify.get('/app/:id-:method:*', (request, reply) =>…
Anonymous
  • 69
  • 12
0
votes
1 answer

Enhance FastifyAdapter with option to normalize the request and response

I was able to find a way to normalize the request and response in a fastify onrequest hook, so that middleware written for express, like swagger-stats, can be used with fastify. I was wondering if there would be any interest in me adding this as an…
0
votes
1 answer

ldapjs-client V0.1.0 bind method throwing UnwillingToPerformError after working fine for few days

I am facing a weired issue on ldapjs-client V0.10.0 with fastify V1.1.1 Below snippet working fine for couple of day. Suddenly throwing UnwillingToPerformError. It is working fine if we restart the server again,error is same after couple of…
technaag
  • 26
  • 3
0
votes
1 answer

fastify is undefined in model

I'm trying fastify with fastify-bookshelfjs. contact (model) module.exports = async function (fastify) { console.log("4") fastify.bookshelf.Model.extend({ tableName: 'contacts', }) } contact (controller) console.log("3") const Contact =…
Phan
  • 115
  • 1
  • 7
0
votes
1 answer

How to replace Javascript variable before serving with fastify?

I have some JS files that I'd like to modify before serving them. They are called with a parameter and I want that parameter to be in the file when served. Example:
HypeWolf
  • 750
  • 12
  • 29
0
votes
2 answers

How to pass a request header to fastify plugin options at register

I can access the request header in a get or post call fastify.get('/route1',(req,res,next)=>{ console.log(req.headers.Authorization) ... } I am looking for a way to pass it to a plugin register call, specifically fastify-graphql const {…
kwalski
  • 580
  • 7
  • 15
0
votes
1 answer

How to augment module in project scope?

I'm using fastify with plugin fastify-static. I also provide my own TypeScript types declaration for this plugin in typings/fastify-static/index.d.ts: declare module "fastify-static" { import { Plugin } from "fastify"; import { Server,…
Szopinski
  • 790
  • 1
  • 10
  • 18
0
votes
0 answers

Sequelize, how structuring return value inside single object

Sorry for my bad English. I have used fastify for my javascript framework and Postgresql as my database and sequelize as my ORM. But problem occured when i have multiple models. This is my Code : // Extract Db const { student} = this.models …
1 2 3
44
45