feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 744 forks source link

Unable to set custom express query parser as described by the docs #3369

Open tobiasheldring opened 7 months ago

tobiasheldring commented 7 months ago

The docs describe in this section how to set a custom query parser. It is however not possible, this was reported before and fixed, but unfortunately the fix was reverted as part of this PR.

Any chance this can be fixed so that it is possible to set custom query parser again?

tobiasheldring commented 7 months ago

Looking closer at the code I realised there is an easy workaround

import feathersExpress from "@feathersjs/express"
import { feathers } from "@feathersjs/feathers"
import express from "express"
import qs from "qs"

const expressApp = express()
expressApp.set("query parser" as any, (str: string) =>
  qs.parse(str, { arrayLimit: 1000 }),
)
const app = feathersExpress(feathers(), expressApp)

Feel free to close this issue, unless you want to use it as basis for updating the docs regarding this

azicchetti commented 2 weeks ago

Hi, I've encountered this issue as well and the "wrong" suggestion in the documentation did not help.

Would be great to patch the "express(feathers())" initialization code, so that we can .set() things before app.configure(rest()), or fix the documentation including the workaround of calling the feathers express constructor with the feathers and the pure express apps.

Thank you very much