# mydb-preload **Repository Path**: mirrors_Automattic/mydb-preload ## Basic Information - **Project Name**: mydb-preload - **Description**: Express helper to preload mydb documents - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2026-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README mydb-preload ============ Express helper to preload mydb documents ## How to use In your middleware, call `preload` with a given `url` and the respective promise: ```js require('mydb-preload'); // to extend the response prototype app.use(function(req, res, next){ res.preload('/user', db.findOne(req.session.userId)); }); ``` Then make sure to include the respective middleware in the routes that will expose the documents: ```js var preload = require('mydb-preload'); app.get('/', preload(), function(req, res, next){ res.render('homepage.jade'); }); ```