3 var express = require('express'),
4 router = express.Router(),
5 path = require('path'),
8 router.post('/', function(req, res) {
9 var note = req.body.note,
10 email = req.body.email,
13 // Return file list at /note/*
16 jb.findOne('user', function(err, documents) {
17 var filesInfo = documents.notes.map(function(note) {
18 var notePath = path.normalize(__dirname+'/../../../notes/'+note)
19 var stat = fs.statSync(notePath)
20 stat.name = note.split('.')[0]
30 var filesInfo = fs.readdirSync(dirPath).filter(function(file) {
31 return file.substring(0,1) !== '.' && file !== 'preview'
38 stat.name = stat.name.split('.')[0]
43 // Return content of the note
45 var noteJSON = require(path.normalize(__dirname+'/../../../notes/'+note+'.json'))
50 module.exports = router;