0

我读了https://github.com/fastify/fastify/blob/master/docs/Routes.md

但是我的路由器似乎没有使用参数捕获正确的 url

网址:/app/name?id=666&method=3&_=1553342444710

我试过了:

fastify.get('/app/:id-:method:*', (request, reply) => {
fastify.get('/app/*', (request, reply) => {
fastify.get('/app/:id-:method:-:_', (request, reply) => {
4

1 回答 1

1

尝试这个:

fastify.get('/app/name', {
  schema: {
    querystring: {
      id: { type: 'integer' },
      name: { type: 'string' },
      _: { type: 'integer' },
    }
  },
},
(request, reply) => {
  ...
于 2019-03-23T15:49:06.317 回答