Skip to content
This repository was archived by the owner on Jan 31, 2019. It is now read-only.
This repository was archived by the owner on Jan 31, 2019. It is now read-only.

router integration issues due to closure scope... maybe #4

Description

@julesmoretti

Hey there, so I have been struggling to find a node template that works right off the bat with codeship. This one did the trick. But since the app.js is wrapped in a var app = function () { trying to add within routes using var routes = require('./routes/routes'); and then app.use('/routes', routes); does not work when in the routes.js file I try to use var router = express.Router(); and:

router.get('/', function(req, res, next) {
    res.render('index', { title: "Codefish", header: "I've entered the Codeship!", paragraph: "I just deployed my Node.js app with Codeship" });
});

Similarly if I try to refactor the app.js and remove the var app = function () { and inject into it the app.listen(... from start.js and alter the package.json to "main": "app.js", that works locally, but when I run it through to codeship > heroku, node does not automatically load and so nothing gets served... Any idea why this might be the case? Would you have a refactored version that works with routes etc...? Thank you.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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