feathers icon indicating copy to clipboard operation
feathers copied to clipboard

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

Open tobiasheldring opened this issue 1 year ago • 2 comments

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 avatar Dec 06 '23 12:12 tobiasheldring

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

tobiasheldring avatar Dec 06 '23 12:12 tobiasheldring

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

azicchetti avatar Jun 19 '24 16:06 azicchetti