0.0.2 • Published 10 years ago

mythos-contrib-express-path v0.0.2

Weekly downloads
1
License
ISC
Repository
github
Last release
10 years ago

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