var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var imageSchema = new Schema({
name: String,
data: Buffer,
contentType: String
});
var Image = mongoose.model('Image', imageSchema);
function getImage(name) {
Image.findOne({ name: name }, function (err, image) {
if (err) throw err;
res.setHeader('Content-Type', image.contentType);
res.send(image.data);
});
}
Top comments (0)