How to use the node-persist.values function in node-persist

To help you get started, we’ve selected a few node-persist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github covcom / 304CEM / 2015 / 2015 05 RESTful APIs / 02 RESTful APIs / gallery / gallery.js View on Github external
exports.getAllPhotos = (request, callback) => {
	console.log('getAll')
	/* We retrieve the array of stored items then use the 'map()' function to add the image url. */
	const data = storage.values().map( item => {
		item.url = 'http://localhost:8080/photos/'+item.filename+'.'+item.extension
		return item
	})
	callback(null, data)
}
github covcom / 304CEM / Lab Demos / week09 / simple_api / testableCode.js View on Github external
exports.countItems = function() {
	const favourites = storage.values()
	if (favourites.length) return true
	return false
}
github covcom / 304CEM / Lab Demos / week09 / simple_api / module.js View on Github external
exports.listFavourites = function listFavourites(req, res) {
	if (testableCode.countItems) {
		res.send({ favourites: storage.values()})
		res.end()
	} else {
		res.send(400, 'no favourites in list')
		res.end()
	}
}
github sammacbeth / dat-fox-helper / src / library.js View on Github external
async listLibrary() {
        await this.ready;
        return storage.values();
    }