Skip to content

Instantly share code, notes, and snippets.

View bajtos's full-sized avatar

Miroslav Bajtoš bajtos

View GitHub Profile
@bajtos
bajtos / discovery.js
Last active April 18, 2018 08:44
Discover LoopBack models
'use strict';
const loopback = require('loopback');
const promisify = require('util').promisify;
const fs = require('fs');
const writeFile = promisify(fs.writeFile);
const mkdirp = promisify(require('mkdirp'));
const app = loopback();
const db = app.dataSource('db', {
@bajtos
bajtos / text.md
Created February 2, 2018 10:54
On experimental and in-progress pull requests

On experimental and in-progress pull requests

Introduction

A recent discussion on GitHub (link) triggered a discussion about the protocol to use for work that takes longer to complete and/or is experimental.

So far, it seems the team reached the following consenus:

  • Pull request with a title prefixed with [WIP] are not done and ready for proper review. Early feedback is welcome though.
  • Pull requests with a title prefixed with [DO NOT REVIEW] should not be looked at at all.
@bajtos
bajtos / text.md
Created June 2, 2017 07:29
How we developed LoopBack 3.0

How to develop LoopBack 3.0

Based on the current roadmap for v3.0, it will take several months until we will be able to cut the final 3.0.0 release. In the meantime, we need keep improving 2.x series that most customers are running on. This document describes the process.

Note that we are bumping up the major version to 3.0 primarily in order to allow us to make breaking changes, as ruled by semver. This is different from marketing practice of bumping up the major version to create an impression that the product has matured to a next level.

Branching strategy

Not all loopback modules have to be bumped to 3.0. We will keep using the current major version (typically 2.x) in all modules where we can preserve backwards compatibility. The major version will be bumped (and a major-version branch will be created) only at the point when we need to land a backwards incompatible (breaking) change.

@bajtos
bajtos / Instructions.md
Created September 9, 2014 16:27
Add a custom remote method to a full-stack LoopBack AngularJS applications

This is an extra exercise for the workshop Building a full-stack application with LoopBack and AngularJS.

Add a custom model method

Let's write a method Whiskey.prototype.ratingStats that will provide a breakdown of rating data for a given whiskey. This method should be defined in common/models/whiskey.js. Below is a template, it's up to the reader to implement the statistical computation.

@bajtos
bajtos / Git intro.md
Last active January 3, 2017 15:32
Introduction to GitHub workflow
@bajtos
bajtos / text.md
Last active September 27, 2016 22:06
LoopBack Replication & Offline sync

The offline data access & synchronization is built from three components:

  1. Change tracking
  2. Replication of changes
  3. Browser version of LoopBack

Setup

Enable change tracking

@bajtos
bajtos / issues.md
Last active June 8, 2016 11:34
Coercion in strong-remoting

Coercion in strong-remoting - issues & changes

Changes introduced by v2.16.1

json body - array of booleans: non-boolean values (null, 0, 1, 2) are coerced to booleans. String items "true"/"false" are converted to true/false.

json body - arrays: scalar values are coerced to arrays, e.g. request body 1 is converted to [1].

form data - arrays: malformed JSON-like value is treated as verbatim string. E.g. ?arg={malformed} is converted to ['{malformed}'].

@bajtos
bajtos / hooks-status.md
Last active April 18, 2016 09:53
LoopBack Hooks
@bajtos
bajtos / 0-desc.md
Last active January 13, 2016 00:08
LoopBack Realtime

Imagine a chat server persisting the messages, a simplified Slack chat. The domain is designed in the object-orientated style. In order to get realtime updates, we need to transport events emitted on the model constructor ("static" events) and on a model instance ("instance" events).

While it may not be immediately clear, the example is covering few other important LoopBack concepts too:

  • authorization (loopback.token in REST)
  • current context (loopback.context in REST)

What is not covered:

  • file uploads and downloads
@bajtos
bajtos / checklist.md
Created January 15, 2014 11:52
Checklist for LBUser implementation in iOS and Android SDKs.

Checklist for LBUser implementation in iOS and Android SDKs.

Basic auth worklow:

  1. Login as an existing user (email + password).
  2. All REST calls are using the access token obtained in step 1
  3. Log out

Advanced: