app/middleware/mongoose.js should have this change #48

Closed
bengitscode opened this Issue Mar 6, 2017 · 8 comments

Comments

Projects
None yet
5 participants
@bengitscode

bengitscode commented Mar 6, 2017

per @payne-chris-r in 016 delivery.

The wiring has moved since the last update to this template.

app/middleware/mongoose.js

'use strict';

- const database = require('../../config/database');
+ const database = require('config/database');
const mongoose = require('mongoose');
const uri = process.env.MONGODB_URI || database.mongoose.uri;
mongoose.Promise = global.Promise;
mongoose.connect(uri);

module.exports = mongoose;

Though this may not be necessary, see @bernardlee 's comment below.

@bernardlee

This comment has been minimized.

bernardlee commented Mar 6, 2017

Ben and I were going through this repository together last week (2017-03-03) to figure out why MongoDB wasn't working during the deployment process. We saw the line const database = require('config/database'); as we were going through the stack trace and thought that it might have been an error since require() needs relative paths to resolve non-packaged files, but it turns out that Antony wrote a loading library to resolve paths like this so that there aren't any problems when running this application with ./bin/express server. I think that there were problems during the talk because the files were being run in the command line interface (e.g. node ./bin/aws-upload.js ...).

@payne-chris-r

This comment has been minimized.

@payne-chris-r

This comment has been minimized.

Contributor

payne-chris-r commented Mar 6, 2017

This is actually baked in to express template and just means you have to set NODE_PATH to $PWD before running the script.

@payne-chris-r

This comment has been minimized.

Contributor

payne-chris-r commented Mar 6, 2017

Question. What if in scripts portion of package.json we changed "node" to set PWD, then run node?

@bengitscode

This comment has been minimized.

bengitscode commented Mar 6, 2017

Ah that makes sense. Thanks for the clarification @payne-chris-r

@payne-chris-r

This comment has been minimized.

Contributor

payne-chris-r commented Mar 6, 2017

"scripts": {
"start": "./bin/express server",
"run": "NODE_PATH... node "???
},

@gaand

This comment has been minimized.

gaand commented Mar 7, 2017

That can't work, unfortunately. We'd need to wire something up with grunt.

@gaand gaand referenced this issue Mar 7, 2017

Closed

Add grunt nodemon #49

@jrhorn424

This comment has been minimized.

Contributor

jrhorn424 commented May 3, 2017

I recommend looking at this: https://github.com/jsoverson/grunt-env

Should work fine as a task dependency for nodemon once that's added (#49).

jrhorn424 pushed a commit that referenced this issue May 3, 2017

Jeffrey Horn
Add nodemon
- Add nodemon configuration for express
- Remove now-unused shell package

Close #31
Close #48
Close #49

@gaand gaand closed this in 46b2861 May 5, 2017

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