node-http-server2

1.1.0 • Public • Published

node-http-server2

This is a httpserver that support jshp.
You can use it to create REST API or some webpage.

There is no longer support jshp default after version 1.1.x+,so node-http-server2 is a static file server now. But if you want use jshp ,i reserved a set_custom_parser function. you can download jshp_parser for node-http-server2 and set it.
for example:

var jshp_parser = require("./jshp_parser");
web_service.set_custom_parser("jshp",jshp_parser);

Note:jshp_parser depend on formidable & node-jshp

Install

npm install node-http-server2

How to Use

var server =require('node-http-server');
server.start("/srv/www/node/",80);

JSHP variables and functions

variables->

  • $_GET:like $_GET in PHP
  • $_POST:like $_POST in PHP
  • $_FILES:like $_FILES in PHP
    • name:filename
    • size:filesize
    • type:file type
    • tmp_name:temp path
functions->
  • require:require in Node.js.
  • set_header:set response header value
    example:
    set_header('Content-Type','text/html')
  • s
  • run_script:run another jshp script
    example:
      var params={a:1};
      run_script("./a.jshp",params,function(err,status_code,header,data){
    
    	if(err) end(err.message);
    
      end(data);
    });
    </PRE>
    
DEMO ========= picture:http://cloudstudio.mobi/demo/firefox.png
HTML file:http://cloudstudio.mobi/demo/static.html
JSHP file:http://cloudstudio.mobi/demo/server_time.jshp License ======== (The MIT License)

Copyright (c) 2014 Chun-Yen Wu

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Readme

Keywords

Package Sidebar

Install

npm i node-http-server2

Weekly Downloads

18

Version

1.1.0

License

none

Last publish

Collaborators

  • enoch