2015-04-10 19:23:52 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-04-12 22:19:42 +00:00
|
|
|
var _ = require('underscore'),
|
|
|
|
project = require('../lib/project');
|
|
|
|
|
2015-04-12 22:41:09 +00:00
|
|
|
var projects,
|
|
|
|
projectConfigs;
|
|
|
|
|
2015-04-12 22:19:42 +00:00
|
|
|
project.loadAll('projects', function(err, loadedProjects) {
|
|
|
|
if (err) throw err;
|
|
|
|
projects = loadedProjects;
|
2015-04-12 22:41:09 +00:00
|
|
|
projectConfigs = _(projects).pluck('config');
|
|
|
|
console.log('Loaded projects: ', _(projectConfigs).pluck('name'));
|
2015-04-12 22:19:42 +00:00
|
|
|
});
|
|
|
|
|
2015-04-10 19:23:52 +00:00
|
|
|
module.exports = function(data) {
|
2015-04-12 22:41:09 +00:00
|
|
|
var resource = data.resource('projects');
|
|
|
|
|
|
|
|
resource.use('read', function(req, res) {
|
|
|
|
res.send(projectConfigs);
|
|
|
|
});
|
2015-04-10 19:23:52 +00:00
|
|
|
};
|