Skip to content

Semantics concerning ViewController and bundle.js served by Hapi #14

@nogtini

Description

@nogtini

Trying to tackle a 500 error wherein

'use strict'

const Controller = require('trails-controller')

module.exports = class ViewController extends Controller {

  render (request, reply) {
    reply.view('components/environments/TrailsMix')
  }
}

is trying to serve the app via the root component as a "view". Note that components/... is a pre-build folder, so all views attempting to be served are being looked for these components in the dist folder which only contains the bundle to be served.

As such, this bundle.js is no view, but rather simply the payload needed for the browser to take control, spinning up the SPA.

Ideally, we'd want to solve this simply by not extending or rendering from the Controller, but instead simply serving the bundle via the controller on the index request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions