Home

Issue: 1138

TypeError: app.use() requires middleware functions (using nuxt ^1.0.0-alpha.3)

[issue link]

can someone help me, error from here 😄

import Nuxt from 'nuxt'
import express from 'express'

const app = express()
const host = process.env.HOST || '127.0.0.1'
const port = process.env.PORT || 3000

app.set('port', port)

// Start nuxt.js
async function start() {
  // Import and Set Nuxt.js options
  let config = require('../nuxt.config.js')
  config.dev = !(process.env.NODE_ENV === 'production')
  // Instanciate nuxt.js
  const nuxt = new Nuxt(config)
  // Add nuxt.js middleware
  app.use(nuxt.render) # !!!!! error here (seems like) !!!!!!!
  // Listen the server
  app.listen(port, host)
  console.log('Server listening on ' + host + ':' + port) // eslint-disable-line no-console
}

start()

full error on yarn run dev (backpack dev)

 DONE  Compiled successfully in 65ms                                                                                          9:44:32 PM

(node:11837) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: app.use() requires middleware functions
This question is available on Nuxt.js community (#c1003)