Package Exports
- partial.js
- partial.js/builders
- partial.js/utils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (partial.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
web application framework for node.js
- Homepage / www.partialjs.com
- Follow partial.js on Twitter @partialjs
- Async web framework - example
- Simple view engine - example
- Simple routing + support flags ['xhr', 'post', 'get', 'put', 'delete', 'upload', 'json', 'logged', 'unlogged', 'debug'] - example
- Simple cacheing - http cache example, partial cache example
- Simple directory structure (controllers, modules, public, logs, tmp, templates, views, resources)
- Simple code structure
- Simple error handling
- Simple cookie manipulation - example
- Simple listing via templates - example
- XSS protection
- Share controller functions and models over framework - example
- Assertion Testing - example
- Supports custom helpers - example
- Supports routing to static file for dynamic creating static file - example
- Supports controller sharing between other controllers - example
- Supports debug mode with custom settings without cache - example
- Supports file upload - example
- Supports copy&paste custom code between projects - example
- Supports modules (module can create route, view, template, content, resource or static CSS/JS file) - example
- Supports form data validation - example
- Supports simple log writer - example
- Supports simple restrictions example
- Supports static files
- Supports JavaScript compress
- Supports JavaScript dynamic compress in views - example
- Supports simple LESS CSS (with compress) - example
- Supports Markdown parser - example
- Supports resources (for multilanguage pages) - example
- Supports prefixes for mobile devices - example
- Supports simple SMTP mail sender - example
- Supports simple mail templating - example
- Supports simple ORM (via HTTP-RDBMS)
- Supports custom authorization - example
- Supports HTTP-RDBMS provider (MySQL, SQL Server, OleDB, ODBC), more on https://github.com/petersirka/http-rdbms/
- Supports simple CouchDB provider - example
- Supports REST API MongoDB via https://mongolab.com - example
- Supports simple image processing (resize, crop, blur, sepia, grayscale, etc.) with GraphicsMagick or ImageMagick - example
- Easy adding dynamic META tags in views or controllers - example
- Easy adding dynamic Settings in views or controllers - example
- Simple use paypal payment with node-paypal - example
- Supports simple paging builder - example
- Supports live usage information - example
- Supports dynamic stop server - example
- Supports verification of framework - example
- About 8 000 lines of JavaScript code
- No dependencies
- More examples
I am still improving my english. Please do not hesitate to contact me in any contradictions.
Simple eshop example
partial.js homepage
partial.js documentation
http://partialjs.com/documentation/
Run your website:
- download empty website project
- open terminal and find website directory
- write and run on terminal:
$ node index.js
NPM partial.js
- create on your desktop empty directory with name: website
- create file index.js
- open terminal and find this directory: cd /Desktop/website/
- write and run on terminal:
$ npm install partial.js
Create empty project from terminal
$ mkdir newproject
$ cd newproject
$ partial.js
or
$ partial.js /users/petersirka/desktop/newproject/
Plans
I want perfect and stability web application framework. Currently is framework in testing mode and stable version will be in short time.
Simple example
index.js
var framework = require('partial.js');
var http = require('http');
var port = parseInt(process.argv[2] || '8000');
var debug = true;
framework.init(http, debug, port);
// Initialize controllers
framework.controller('global');
console.log("http://127.0.0.1:{0}/".format(port));
controllers / global.js
exports.init = function() {
var self = this;
self.route('/', viewHomepage);
// self.route('/registration/', viewRegistration, ['xhr', 'post']);
// self.route('/products/{category}/', viewProducts);
// self.route('/products/{category}/{subcategory}/', viewProducts);
// self.route('/user/', viewUser, ['logged']);
};
function viewHomepage() {
var self = this;
self.repository.title = 'Web application framework';
self.view('homepage', { name: 'Peter' });
}
views / _layout.html
<!DOCTYPE html>
<html>
<head>
@{meta}
<meta charset="utf-8" />
<meta http-equiv="content-language" content="sk" />
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<meta name="format-detection" content="telephone=no"/>
<meta name="viewport" content="width=1024, user-scalable=yes" />
<meta name="robots" content="all,follow" />
<link rel="stylesheet" href="@{routeCSS('p.css')}" />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="@{routeJS('p.js')}" ></script>
</head>
<body>
<div class="content">
@{body}
</div>
</body>
</html>
views / homepage.html
@{meta('My Homepage', 'My Homepage description', 'My Homepage keywords')}
<h1>@{repository.title}</h1>
Welcome @{model.name}!
RESULT
<!DOCTYPE html>
<html>
<head>
<title>My Homepage</title>
<meta name="description" content="My Homepage description" />
<meta name="keywords" content="My Homepage keywords" />
<meta charset="utf-8" />
<meta http-equiv="content-language" content="sk" />
<meta http-equiv="X-UA-Compatible" content="IE=10" />
<meta name="format-detection" content="telephone=no"/>
<meta name="viewport" content="width=1024, user-scalable=yes" />
<meta name="robots" content="all,follow" />
<link rel="stylesheet" href="/data/p.css" />
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="/data/p.js" ></script>
</head>
<body>
<div class="content">
<h1>Web application framework</h1>
Welcome Peter!
</div>
</body>
</html>
The MIT License
Copyright (c) 2012-2013 Peter Širka petersirka@gmail.com
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.