AliceSPA on Github Documents

What is AliceSPA?

AliceSPA is an framework for building beautiful, simple and powerful single page applications. A backend server and a frontend client have been implemented with some basic functions, such as account system, role authentication, captcha, direct database accessing. AliceSPA have a protocol for communications between server and client, and do every thing quiet. There are also some extensions of AngularJS for quickly developing your application. Some knowledge of basic libraries is required. Slime framework and medoo are used in backend, AngularJS 1.x is used in client.

//Server PHP
utils::secureRoute(
        $app->post('/api/product','\Your\NameSpace\ProductController:handle'),//Register your API url and set a method to handle it.
        ['productManager','admin'],//Current user must have these roles.
        'image',//Current request must have correct image captcha.
        ['product' => ['select','update','delete','insert']]//Client can directly access specified database table and actions under this API.
    );
                
//Client JavaScript
angular.ASPAModule('app',['AliceSPA'])//AliceSPA extend AngularJS with new features.
.run(['ASPADirectDatabaseService','ASPAAPIProtocolService','ASPADirectiveHandleService',function(ASPADirectDatabaseService,ASPAAPIProtocolService,ASPADirectiveHandleService){//Inject AliceSPA services.
    ASPADirectDatabaseService.select('/api/product','product','*',{'create_date[>]':'2016-09-04 15:36:00'})//SELECT * FROM product WHERE create_date > "2016-09-04 15:36:00"
    .then(
        function(successData){
        },
        function(failureErrors){
        }
    );

    var imageCaptchaId = ASPADirectiveHandleService.getASPACaptchaImageHandle('myHandle').id;//Get handle with dynamic generated method.
    var options = ASPAAPIProtocolService.makeImageCaptchaOptions(null,imageCaptchaId,'captchaCode');//Fill in addons.
    ASPAAPIProtocolService.post('/api/product/add',{'name':'productName','price':23},null,options).then(//Send request and AliceSPA will check roles and captcha.
        function(successData){
        },
        function(failureErrors){
        }
    );
}]);
                
                

Free

AliceSPA is licensed under the MIT license.

Contributors

ruojianll

E-MAIL: ruojianll@gmail.com
E-MAIL: 972372527@qq.com

MengXiangXiX

E-MAIL: 1528219692@qq.com