How to use the fastify/lib/symbols.kRoutePrefix function in fastify

To help you get started, we’ve selected a few fastify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fastify / middie / index.js View on Github external
function use (path, fn) {
    if (typeof path === 'string') {
      const prefix = this[symbols.kRoutePrefix]
      path = prefix + (path === '/' && prefix.length > 0 ? '' : path)
    }
    this[kMiddlewares].push([path, fn])
    if (fn == null) {
      this[kMiddie].use(path)
    } else {
      this[kMiddie].use(path, fn)
    }
    return this
  }

fastify

Fast and low overhead web framework, for Node.js

MIT
Latest version published 28 days ago

Package Health Score

97 / 100
Full package analysis