yode-rewrite

0.0.1 • Public • Published

Yode-server url rewrite plugin

NPM

Setup

npm install yode-rewrite

Add to a global config file ./server.js in plugins list:

var server = require('yode-server')

server.start({
    port: 80,
    projects_dir: __dirname + '/www',    
    tmp_dir: __dirname + '/tmp',         
    plugins: [
        'yode-rewrite'    
    ]
})

Usage

Example 1:

to serve http://<host>/catalogue/tv/lcd as http://<host>/catalogue/?section=tv&type=lcd, add to a project config www/<project_dir>/config.js:

.....

REWRITE_RULES: {
 "^\\/catalogue\\/([a-zA-Z^\\/]{1,})\\/([a-zA-Z^\\/]{1,})": "/catalogue/?section=$1&type=$2"
}
.....

Example 2:

to serve http://<host>/path.to.module.method/ as http://<host>/path.to.module:method/, add to a project config www/<project_dir>/config.js:

.....

REWRITE_RULES: {
    "^(\\/[a-zA-Z\\.^\\/^\\/]{1,})\\.([a-zA-Z^\\/]{1,})\\/":"$1:$2"
}

.....

LICENSE: LGPL v2.1

Readme

Keywords

none

Package Sidebar

Install

npm i yode-rewrite

Weekly Downloads

0

Version

0.0.1

License

LGPL-2

Last publish

Collaborators

  • kolbaskin