RPC Node JS RPC action users method Query

  • Slides: 16
Download presentation
RPC в Node. JS

RPC в Node. JS

[ ] Пример RPC запроса { } “action”: “users”, “method”: “Query”, “data”: [{ “filter”:

[ ] Пример RPC запроса { } “action”: “users”, “method”: “Query”, “data”: [{ “filter”: [{ “property”: “login”, “value”: “user” }] }], “type”: “rpc”, “tid”: 1 Документация: https: //www. appcode. pw/? page_id=463

RPC «сущность» в Node. JS exports. [имя сущности] = function(session) { return { is.

RPC «сущность» в Node. JS exports. [имя сущности] = function(session) { return { is. Local: true, /// !!! } 06 }; [имя сущности]: function(data, callback) { callback([результат]); }

Регистрация созданной сущности в RPC var shell = require('postgresql-rpc-shell'); var shell. Object = {

Регистрация созданной сущности в RPC var shell = require('postgresql-rpc-shell'); var shell. Object = { db: db, namespace: ns, contexts: [ require('. /modules/webapi'), require('. /modules/adminapi') ], … }; 08 app. use(shell. Object));

Взаимодействие с БД Запуск node bin/www Подключение к БД и генерация схемы … var

Взаимодействие с БД Запуск node bin/www Подключение к БД и генерация схемы … var render = require('dynamic-schema-reader'); // модуль генерации шаблонов module. exports = function (callback) { reader({ … connection. String: connection. String auto. Remove: true, schema. List: ["'core'", "'public'", . . . ] }, function (schemas) { var content = ejs. compile(…); fs. write. File. Sync(path, content); … }); } Генерация dbcontext. js

Пример dbcontext. js

Пример dbcontext. js