用NextJS固定

时间:2020-05-01 14:01:02

标签: fastify

我正在寻找有关如何使用fastify-nextjs启动fastify-cli的建议

我试图将代码简单地添加到建议的位置,但是它不起作用。

'use strict'

const path = require('path')
const AutoLoad = require('fastify-autoload')

module.exports = function (fastify, opts, next) {
  // Place here your custom code!

  fastify.register(require('fastify-nextjs'))
      .after(() => {
        fastify.next('/hello')
      })

  // Do not touch the following lines

  // This loads all plugins defined in plugins
  // those should be support plugins that are reused
  // through your application
  fastify.register(AutoLoad, {
    dir: path.join(__dirname, 'plugins'),
    options: Object.assign({}, opts)
  })

  // This loads all plugins defined in services
  // define your routes in one of these
  fastify.register(AutoLoad, {
    dir: path.join(__dirname, 'services'),
    options: Object.assign({}, opts)
  })

  // Make sure to call next when done
  next()

}

0 个答案:

没有答案