app.use('/static', express.static(__dirname + '/static')); app.use(bodyParser.urlencoded({ extended: true })); /* Configure nunjucks to work with express Not using consolidate because I'm waiting on better support for template inheritance with nunjucks via consolidate. See: https://github.com/tj/consolidate.js/pull/224 */ var env = nunjucks.configure('views', { autoescape: true, express: app }); var nunjucksDate = require('nunjucks-date'); nunjucksDate.setDefaultFormat('MMMM Do YYYY, h:mm:ss a'); env.addFilter("date", nunjucksDate); var ITEMS_PER_PAGE = 5; // Hardcoded USERID for use with the shopping cart portion var USERID = "558098a65133816958968d88"; //MongoClient.connect('mongodb://*****:*****@ds017582.mlab.com:17582/shoppingmart-natarajgandhi', function (err, db) { "use strict"; assert.equal(null, err); console.log("Successfully connected to MongoDB.");
// parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })) // parse application/json app.use(bodyParser.json()) // static files app.use('/static', express.static(__dirname + '/public')) // templating var env = nunjucks.configure('views', { autoescape: false, express: app }) nunjucksDate.setDefaultFormat('MMMM Do YYYY, HH:mm:ss'); nunjucksDate.install(env); // Let's get the users so we can store / update their avatars var avatars = []; var avatars_id = []; var team_url = "https://" + config.get('slack').domain + ".slack.com/team/"; var users_url = "https://slack.com/api/users.list?token=" + config.get('slack').api_token request(users_url, function (error, response, body) { if (!error && response.statusCode == 200) { const users_list = JSON.parse(body); for (var user in users_list.members) { avatars[users_list.members[user].name] = users_list.members[user].profile.image_48; avatars_id[users_list.members[user].id] = users_list.members[user].name; }