-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (29 loc) · 973 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var mongoose = require('mongoose')
var base_folder = '../../public/uploads'
exports._models = function() {
require('./models/media')
require('./models/bundle')
}
exports._route = function (app, auth) {
var bundlr = require('./controllers/bundlr')
, Media = mongoose.model('Media')
app.get('/media/:m_id/json', bundlr.viewJSON)
app.post('/media/:m_id', bundlr.media.update)
app.post('/media/:m_id/page/:p_id', bundlr.updatePage)
app.get('/media/:m_id/delete/:size_key', bundlr.destroyRender)
app.get('/media/:m_id/:width/:height', bundlr.view)
app.get('/media/:m_id/:size_key?', bundlr.view)
app.param('m_id', function(req, res, next, id) {
Media
.findOne({_id:id})
.exec(function(err, media) {
// console.log('meida ', media)
req.media = media
next()
})
})
}
exports.upload = function(req, res, next) {
var bundlr = require('./controllers/bundlr')
return bundlr.upload(req,res,next)
}