Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elephas

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elephas - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

46

lib/routes.js

@@ -1,8 +0,7 @@

'use strict';
var express = require('express');
var logger = require('./logger');
var findFiles = require('./findFiles');
var express = require('express'),
logger = require('./logger'),
findFiles = require('./findFiles');
var async = require('async');
var _ = require('lodash');

@@ -21,2 +20,24 @@ function toRouter(r) {

function toLogs(files) {
var routes = _.chain(files)
.map(function(r) {
var routePaths = [];
_.forIn(r, function(v, k) {
routePaths.push(k);
});
return routePaths;
})
.reduce(function(a, b) { return a.concat(b); })
.sortBy()
.value();
logger.debug('Added routes');
routes.forEach(function(r) {
logger.debug(r);
});
}
module.exports = function(cb, app, path) {

@@ -36,3 +57,4 @@ var _paths = path;

files.map(function(f) {
// Require route file and create express router
var routeFiles = files.map(function(f) {
var r = require(f);

@@ -46,11 +68,11 @@

return {router: toRouter(r, prefix), path: '', name: prefix};
})
.forEach(function(r) {
var route = '/' + r.path;
app.use('/', toRouter(r, prefix));
app.use(route, r.router);
logger.debug('Added routes for /' + r.name);
// return {router: toRouter(r, prefix), path: '', name: prefix};
return r;
});
// Log out all routes that were found and added
toLogs(routeFiles);
return done();

@@ -57,0 +79,0 @@ });

{
"name": "elephas",
"version": "0.2.8",
"version": "0.2.9",
"description": "Some added sugar on top of express to give our our some sensible defaults and a little structure.",

@@ -5,0 +5,0 @@ "main": "elephas.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc