I'm having trouble requiring a configuration file in a node/express application I'm starting for learning purposes:
structure
app.js
-/config/environment.js
-/views
-/public
app.js
var express = require('express');
var app = express();
var config = require('./config/enviroment')(app, express);
environment.js
module.exports = function(app, express) {
app.configure(function() {
app.use(express.logger());
app.use(express.static(__dirname + '/public'));
app.set('views', __dirname + '/views');
app.set('view engine', 'jade'); //extension of views
});
error
Error: Cannot find module './config/enviroment'
stack
Sorry for asking such a simple question - it seems like it should work. I've checked file/directory permissions - everything seems in order. I'm able to serve views etc. from adjacent folders when I move the view configuration into app.js - so I don't think it's a permissions issue.
You have a typo in your require statement -
require('./config/enviroment')(app, express)
vs
require('./config/environment')(app, express)