How to use backend-js - 9 common examples

To help you get started, we’ve selected a few backend-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github QuaNode / beamjs / index.js View on Github external
beam.database = function (path, options) {

    if (typeof arguments[1] === 'string' || typeof arguments[2] === 'string') return {

        dbType: arguments[0],
        dbURI: arguments[1],
        dbName: arguments[2]
    };
    if (started || !options) return backend;
    if (!ModelControllerPath[options.type]) throw new Error('Invalid database type.');
    started = true;
    var ModelController = require(ModelControllerPath[options.type]);
    module.exports.ComparisonOperators = ModelController.ComparisonOperators;
    module.exports.LogicalOperators = ModelController.LogicalOperators;
    module.exports.ComputationOperators = ModelController.ComputationOperators;
    backend.setComparisonOperators(ModelController.ComparisonOperators);
    backend.setLogicalOperators(ModelController.LogicalOperators);
    backend.setComputationOperators(ModelController.ComputationOperators);
    backend.setModelController(ModelController.getModelControllerObject(options, function () {

        // if (!error) {

        // } else {

        // }
    }), path);
    return backend;
};
github QuaNode / beamjs / index.js View on Github external
if (typeof arguments[1] === 'string' || typeof arguments[2] === 'string') return {

        dbType: arguments[0],
        dbURI: arguments[1],
        dbName: arguments[2]
    };
    if (started || !options) return backend;
    if (!ModelControllerPath[options.type]) throw new Error('Invalid database type.');
    started = true;
    var ModelController = require(ModelControllerPath[options.type]);
    module.exports.ComparisonOperators = ModelController.ComparisonOperators;
    module.exports.LogicalOperators = ModelController.LogicalOperators;
    module.exports.ComputationOperators = ModelController.ComputationOperators;
    backend.setComparisonOperators(ModelController.ComparisonOperators);
    backend.setLogicalOperators(ModelController.LogicalOperators);
    backend.setComputationOperators(ModelController.ComputationOperators);
    backend.setModelController(ModelController.getModelControllerObject(options, function () {

        // if (!error) {

        // } else {

        // }
    }), path);
    return backend;
};
github QuaNode / beamjs / index.js View on Github external
if (typeof arguments[1] === 'string' || typeof arguments[2] === 'string') return {

        dbType: arguments[0],
        dbURI: arguments[1],
        dbName: arguments[2]
    };
    if (started || !options) return backend;
    if (!ModelControllerPath[options.type]) throw new Error('Invalid database type.');
    started = true;
    var ModelController = require(ModelControllerPath[options.type]);
    module.exports.ComparisonOperators = ModelController.ComparisonOperators;
    module.exports.LogicalOperators = ModelController.LogicalOperators;
    module.exports.ComputationOperators = ModelController.ComputationOperators;
    backend.setComparisonOperators(ModelController.ComparisonOperators);
    backend.setLogicalOperators(ModelController.LogicalOperators);
    backend.setComputationOperators(ModelController.ComputationOperators);
    backend.setModelController(ModelController.getModelControllerObject(options, function () {

        // if (!error) {

        // } else {

        // }
    }), path);
    return backend;
};
github QuaNode / beamjs / index.js View on Github external
dbType: arguments[0],
        dbURI: arguments[1],
        dbName: arguments[2]
    };
    if (started || !options) return backend;
    if (!ModelControllerPath[options.type]) throw new Error('Invalid database type.');
    started = true;
    var ModelController = require(ModelControllerPath[options.type]);
    module.exports.ComparisonOperators = ModelController.ComparisonOperators;
    module.exports.LogicalOperators = ModelController.LogicalOperators;
    module.exports.ComputationOperators = ModelController.ComputationOperators;
    backend.setComparisonOperators(ModelController.ComparisonOperators);
    backend.setLogicalOperators(ModelController.LogicalOperators);
    backend.setComputationOperators(ModelController.ComputationOperators);
    backend.setModelController(ModelController.getModelControllerObject(options, function () {

        // if (!error) {

        // } else {

        // }
    }), path);
    return backend;
};
github QuaNode / beamjs / src / MongoController.js View on Github external
/*jslint node: true */
/*jshint esversion: 6 */
/*global emit*/
/*global _*/
'use strict';

let backend = require('backend-js');
let ModelEntity = backend.ModelEntity;
let QueryExpression = backend.QueryExpression;
let AggregateExpression = backend.AggregateExpression;
let mongoose = require('mongoose');
mongoose.Promise = global.Promise;
let Schema = mongoose.Schema;
let autoIncrement = require('mongodb-autoincrement');
mongoose.plugin(autoIncrement.mongoosePlugin);
require('mongoose-pagination');
var cacheOpts = {

    max: 50,
    maxAge: 1000 * 60 * 2
};
require('mongoose-cache').install(mongoose, cacheOpts);

module.exports.LogicalOperators = {
github QuaNode / beamjs / src / SQLController.js View on Github external
/*jslint node: true */
/*jshint esversion: 6 */
/*global Symbol*/
'use strict';

let backend = require('backend-js');
let ModelEntity = backend.ModelEntity;
let QueryExpression = backend.QueryExpression;
let Sequelize = require('sequelize');
require('sequelize-values')(Sequelize);
let VariableAdaptor = require('sequelize-transparent-cache-variable');
let withCache = require('sequelize-transparent-cache')(new VariableAdaptor()).withCache;

let Op = Sequelize.Op;

var LogicalOperators = module.exports.LogicalOperators = {

    AND: Op.and,
    OR: Op.or,
    NOT: Op.not
};

var ComparisonOperators = module.exports.ComparisonOperators = {
github QuaNode / beamjs / src / SQLController.js View on Github external
/*jslint node: true */
/*jshint esversion: 6 */
/*global Symbol*/
'use strict';

let backend = require('backend-js');
let ModelEntity = backend.ModelEntity;
let QueryExpression = backend.QueryExpression;
let Sequelize = require('sequelize');
require('sequelize-values')(Sequelize);
let VariableAdaptor = require('sequelize-transparent-cache-variable');
let withCache = require('sequelize-transparent-cache')(new VariableAdaptor()).withCache;

let Op = Sequelize.Op;

var LogicalOperators = module.exports.LogicalOperators = {

    AND: Op.and,
    OR: Op.or,
    NOT: Op.not
};

var ComparisonOperators = module.exports.ComparisonOperators = {
github QuaNode / beamjs / src / MongoController.js View on Github external
/*jslint node: true */
/*jshint esversion: 6 */
/*global emit*/
/*global _*/
'use strict';

let backend = require('backend-js');
let ModelEntity = backend.ModelEntity;
let QueryExpression = backend.QueryExpression;
let AggregateExpression = backend.AggregateExpression;
let mongoose = require('mongoose');
mongoose.Promise = global.Promise;
let Schema = mongoose.Schema;
let autoIncrement = require('mongodb-autoincrement');
mongoose.plugin(autoIncrement.mongoosePlugin);
require('mongoose-pagination');
var cacheOpts = {

    max: 50,
    maxAge: 1000 * 60 * 2
};
require('mongoose-cache').install(mongoose, cacheOpts);

module.exports.LogicalOperators = {
github QuaNode / beamjs / src / MongoController.js View on Github external
/*jslint node: true */
/*jshint esversion: 6 */
/*global emit*/
/*global _*/
'use strict';

let backend = require('backend-js');
let ModelEntity = backend.ModelEntity;
let QueryExpression = backend.QueryExpression;
let AggregateExpression = backend.AggregateExpression;
let mongoose = require('mongoose');
mongoose.Promise = global.Promise;
let Schema = mongoose.Schema;
let autoIncrement = require('mongodb-autoincrement');
mongoose.plugin(autoIncrement.mongoosePlugin);
require('mongoose-pagination');
var cacheOpts = {

    max: 50,
    maxAge: 1000 * 60 * 2
};
require('mongoose-cache').install(mongoose, cacheOpts);

module.exports.LogicalOperators = {

    AND: '$and',

backend-js

Backend-js is a layer built above expressjs to enable behaviours framework for nodejs applications.

MIT
Latest version published 2 months ago

Package Health Score

57 / 100
Full package analysis