BVB Source Codes

mongo-express Show index.js Source code

Return Download mongo-express: download index.js Source code - Download mongo-express Source code - Type:.js
  1. 'use strict';
  2.  
  3. // Add routes from other files
  4. const collectionRoute = require('./collection');
  5. const databaseRoute = require('./database');
  6. const documentRoute = require('./document');
  7. const gridFSRoute = require('./gridfs');
  8.  
  9. module.exports = function (config) {
  10.   const exp = {};
  11.  
  12.   const configuredDatabaseRoutes = databaseRoute(config);
  13.   const configuredCollectionRoutes = collectionRoute(config);
  14.   const configuredDocumentRoutes = documentRoute(config);
  15.   const configuredGridFSRoute = gridFSRoute(config);
  16.  
  17.   exp.addDatabase = configuredDatabaseRoutes.addDatabase;
  18.   exp.deleteDatabase = configuredDatabaseRoutes.deleteDatabase;
  19.   exp.viewDatabase = configuredDatabaseRoutes.viewDatabase;
  20.  
  21.   exp.addCollection = configuredCollectionRoutes.addCollection;
  22.   exp.compactCollection = configuredCollectionRoutes.compactCollection;
  23.   exp.deleteCollection = configuredCollectionRoutes.deleteCollection;
  24.   exp.exportColArray = configuredCollectionRoutes.exportColArray;
  25.   exp.exportCsv = configuredCollectionRoutes.exportCsv;
  26.   exp.exportCollection = configuredCollectionRoutes.exportCollection;
  27.   exp.renameCollection = configuredCollectionRoutes.renameCollection;
  28.   exp.updateCollections = configuredCollectionRoutes.updateCollections;
  29.   exp.viewCollection = configuredCollectionRoutes.viewCollection;
  30.   exp.dropIndex = configuredCollectionRoutes.dropIndex;
  31.   exp.reIndex = configuredCollectionRoutes.reIndex;
  32.  
  33.   exp.getProperty = configuredDocumentRoutes.getProperty;
  34.   exp.addDocument = configuredDocumentRoutes.addDocument;
  35.   exp.checkValid = configuredDocumentRoutes.checkValid;
  36.   exp.deleteDocument = configuredDocumentRoutes.deleteDocument;
  37.   exp.updateDocument = configuredDocumentRoutes.updateDocument;
  38.   exp.viewDocument = configuredDocumentRoutes.viewDocument;
  39.  
  40.   exp.addBucket = configuredGridFSRoute.addBucket;
  41.   exp.deleteBucket = configuredGridFSRoute.deleteBucket;
  42.   exp.viewBucket = configuredGridFSRoute.viewBucket;
  43.   exp.addFile = configuredGridFSRoute.addFile;
  44.   exp.getFile = configuredGridFSRoute.getFile;
  45.   exp.deleteFile = configuredGridFSRoute.deleteFile;
  46.  
  47.   // Homepage route
  48.   exp.index = function (req, res) {
  49.     const ctx = {
  50.       title: 'Mongo Express',
  51.       info: false,
  52.     };
  53.  
  54.     if (typeof req.adminDb === 'undefined') {
  55.       return res.render('index');
  56.     }
  57.  
  58.     req.adminDb.serverStatus((err, info) => {
  59.       if (err) {
  60.         // TODO: handle error
  61.         console.error(err);
  62.       }
  63.  
  64.       ctx.info = info;
  65.       res.render('index', ctx);
  66.     });
  67.   };
  68.  
  69.   return exp;
  70. };
  71.  
downloadindex.js Source code - Download mongo-express Source code
Related Source Codes/Software:
XCL-Charts - Android charting libraries (XCL-Charts is a free c... 2017-05-17
scrollMonitor - A simple and fast API to monitor elements as you s... 2017-05-16
XCDYouTubeKit - YouTube video player for iOS, tvOS and macOS 2017-05-16
rails-erd - Generate Entity-Relationship Diagrams for Rails ap... 2017-05-16
np - A better `npm publish` 2017-05-16
kaminari - A Scope & Engine based, clean, powerful, custo... 2017-06-04
python-fire - Python Fire is a library for automatically generat... 2017-06-04
Dapper - Dapper - a simple object mapper for .Net 2017-06-05
pkg - Package your Node.js project into an executable ... 2017-06-05
packer - Packer is a tool for creating identical machine im... 2017-06-05
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top