KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I just started using a new version of Express (2.5.5) that by default creates a ./routes directory along with ./views and ./public Inside of routes there is a index.js file which contains: /* * GET home page. */ exports.index = function(req, res){ res.render('index', { title: 'Express' }) }; by default (after running express from the commandline) and this is the routes section in the main app.js : // Routes app.get('/', routes.index); I've set up a variable for a redis client in the main app.js : var redis = require('redis'), db = redis.createClient(); and I was wondering how I could access the methods of db (and whatever other modules I require in app.js ) in the files contained in ./routes
Tags (comma-separated)
Save Edits
Cancel