yode-rewrite
v0.0.1
Published
url rewrite plugin for yode-server
Downloads
1
Readme
Yode-server url rewrite plugin
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