Lightweight Node.js web application framework on clusters with file server.
How To Install
npm install orangebox
var app = ;app;app;
After run your web server will be working in 3 threads via clusters. To specify the number of threads use:
var count = 8;var app = ;
// invoked for any requests passed to this routerrouter;// Will handle all requests that reference a /testapp;// Will handle all requests that reference a /testapp;// used named keysapp;// routing with regexpapp;
Note: if your handler function has 3 parameters (with "next"), you should be use next(); in it body
Mount the middleware function(s) at the path. If path is not specified, it defaults to "*".
// this middleware will be executed for every request to the appapp
Middleware functions are executed sequentially, therefore the order of middleware inclusion is important.
// this middleware will not allow the request to go beyond itapp// requests will never reach this routeapp
An orangebox app is a valid middleware.
var orangeBox = ;var app = orangeBox;var subApp = orangeBox;subApp;app;
For this feature used node-static Server:
var app = ;// Creating a file server for serving files under a directoryapp;app;// Transfer the file at the given path.app;// Transfer the file as attachment at the given path.app;// Serving files as attachments under a directoryapp;app;
Of course you need to put the pictures to the folder ./public
var app = ;app;app;app;app;app;app;
Application settings variable can be set using app.set(), and retrieved using app.get(). The following settings are provided to alter how OrangeBox will behave:
- env Environment mode, defaults to process.env.NODE_ENV or "development"
- case sensitive routing Enable case sensitivity, disabled by default, treating "/Foo" and "/foo" as the same
- strict routing Enable strict routing, by default "/foo" and "/foo/" are treated the same by the router
- view cache Enables view template compilation caching, enabled in production by default
- view engine The default engine extension to use when omitted
- views The view directory path, defaulting to "process.cwd() + '/views'"
- multiparty autoFiles Enable additional uploading conditions.
- multiparty maxFilesSize Only relevant when
multiparty autoFilesis true. Limits the total bytes accepted for all files combined. The default is Infinity.
- multiparty uploadDir Only relevant when
multiparty autoFilesis true. The directory for placing file uploads in (must be created in advance). You can move them later using fs.rename(). Defaults to os.tmpDir().
- multiparty catchError If true - upload error transferred to the
req.body.multiparty_error, otherwise it is transferred from server response to client.
Aliases In Routes
Author and developer of OrangeBox is Oleksiy Chechel
Copyright (C) 2014 Oleksiy Chechel (firstname.lastname@example.org)
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.