Skip to content

A plugin for Fastify that adds support for parsing URL query parameters with qs

License

Notifications You must be signed in to change notification settings

vanodevium/fastify-qs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Oct 10, 2024
8a32e29 · Oct 10, 2024

History

36 Commits
Oct 10, 2024
Oct 10, 2024
Oct 21, 2019
Oct 10, 2024
Jun 13, 2022
Oct 10, 2024
Oct 10, 2024
May 3, 2023
Oct 10, 2024

Repository files navigation

fastify-qs

Build Status GitHub issues GitHub license npm

A plugin for Fastify that adds support for parsing URL query parameters with qs.

Plugin accepts any options from qs.parse method

This plugin removes all unnecessary ? from the beginning of the query string.

This behavior can be disabled with disablePrefixTrim option.

Install

npm i fastify-qs

Plugin specific options

  • disabled: set true if you want to disable qs parsing
  • disablePrefixTrim: set true if you want to disable

Example

const fastify = require('fastify')()

fastify.register(require('fastify-qs'), {})

fastify.get('/*', (req, reply) => {
  req.query // -> { a: ['1', '2'] }
  reply.send('')
})

// GET: 'http://127.0.0.1/?a[]=1&a[]=2

License

MIT © Vano Devium