Webix Remote - Nodejs
Simple RPC for NodeJS and Webix UI
How to install
npm install webix-remote
How to use
On server side
var remote = ;var api = remote; api; api; express;
On client side
Special parameters
- $req - request object
api;//on client - webix.remote.add(1,2);
Adding static data
You can define some static data which will be available on client side. It is a good place for session data, which need to be shared with a client-side code.
Warning - the data generation method will be called only once, during the api initialization.
//serverapi; //clientvar user = webixremote$user;
API access levels
You can limit api to user's with defined access level.
//only user with 'admin' role will be able to call the methodapi;
Access level is defined in next way
- all methods withouth access modificator is allowed by default
- if req.session.user exists, methods with "user" modificator is allowed
- if req.session.user.role exists, methods with role modification is allowed
//req.session = { user: { role:"admin,levelB"}} api; //allowedapi; //allowedapi; //blocked
You can define your custom logic though
api{ return user : !!requser admin: requser && requserid == 1 ;};
License
MIT