mythos-contrib-express-path

0.0.2 • Public • Published

mythos-contrib-express-path

Mythos contrib module for express-path

Installation

npm install --save mythos-contrib-express-path

Usage

Loading

Autoloading

Open config/autoload.js and add the library.

module.exports = {
    ...
    "lib": {
        ...
        "express-path": true,
        ...
    },
    ...
};

Manual Loading

mythos.load('lib', 'express-path');

Calling the Library

In hooks/routes, create a middleware to wrap express-path.

You can place your routeMap.js in config/routes.js to follow Mythos' directory structure.

var ExpressPath  = require('express-path');
var path         = require('path');
 
module.exports = function (app) {
    "use strict";
 
    app.use(function (req, res, next) {
        var mythos = res.locals.mythos;
 
        mythos.lib.expressPath(app, 'config/routes', {
            "expressRoot": path.join(__dirname, '..') + '/'
        });
 
        // NOTE: Add trailing slash for expressRoot option (current bug with express-path)
 
        next();
    });
};

Read more about express-path...)

License

ISC License

Package Sidebar

Install

npm i mythos-contrib-express-path

Weekly Downloads

2

Version

0.0.2

License

ISC

Last publish

Collaborators

  • hyubs