I'm using hapi-nuxt
in a javascript project similar to a Nuxt tutorial I am watching. I generated the skeleton app using:
npx create-nuxt-app <project-name>
That gives me the following code in server/index.js:
const Hapi = require('hapi')
const consola = require('consola')
const HapiNuxt = require('hapi-nuxt')
const server = new Hapi.Server({
host: process.env.HOST || 'localhost',
port: process.env.PORT || 3000
})
server
.register({
plugin: HapiNuxt
})
.then(() => server.start())
.then(() =>
consola.ready({
message: `Server running at: ${server.info.uri}`,
badge: true
})
)
.catch(err => {
consola.error(err)
throw err
})
Now I want to add the routes listed in server/routes/index.js. I believe the code is similar to:
const routes = require('./routes');
...
routes.forEach(route => {
app.route(route);
}
Assuming that code is correct, where do I put it?