How to use the loopback-datasource-juggler/lib/connectors/memory.Memory.prototype function in loopback-datasource-juggler

To help you get started, we’ve selected a few loopback-datasource-juggler 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 strongloop / loopback-sandbox / server / server.js View on Github external
'use strict';

var loopback = require('loopback');
var boot = require('loopback-boot');

const {Memory} = require('loopback-datasource-juggler/lib/connectors/memory');
Memory.prototype.create = function create(model, data, options, callback) {
  const err = new Error('test');
  err.statusCode = 400;
  err.details = {reason: 'testing'};

var app = module.exports = loopback();

app.start = function() {
  // start the web server
  return app.listen(function() {
    var baseUrl = app.get('url').replace(/\/$/, '');
    console.log('Web server listening at: %s', baseUrl);
    if (app.get('loopback-component-explorer')) {
      var explorerPath = app.get('loopback-component-explorer').mountPath;