Code Monkey home page Code Monkey logo

rncouchbaseexample's Introduction

RNCouchbaseExample

Installation

Install dependencies:

npm install

Install the React Native Couchbase Lite module:

npm install --save react-native-couchbase-lite

Link the module using rnpm:

rnpm link react-native-couchbase-lite

Android

  • Add the following in android/app/build.gradle under the android section:
packagingOptions {
		exclude 'META-INF/ASL2.0'
		exclude 'META-INF/LICENSE'
		exclude 'META-INF/NOTICE'
}
  • Register the module in getPackages of MainActivity.java
  import me.fraserxu.rncouchbaselite.ReactCBLiteManager;

  ...


  @Override
  protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new ReactCBLiteManager()				<----- Register the module
      );
  }

Docker

Create a docker network called couchbase

docker network create --driver bridge couchbase

Run Couchbase Server in a docker container, and put it in the couchbase network

docker run --net=couchbase -d --name couchbase-server -p 8091-8094:8091-8094 -p 11210:11210 couchbase

Start a Sync Gateway container in the couchbase network

docker run --net=couchbase --name couchbase-sync-gateway-moviesapp -p 4984:4984 -d -v /tmp:/tmp/config couchbase/sync-gateway https://raw.githubusercontent.com/jmn8718/RNCouchbaseExample/master/sync-gateway-config.json

Example Data

To load the data for the example, run the following command in a terminal

curl -H 'Content-Type: application/json' -vX POST 'http://localhost:4984/moviesapp/_bulk_docs' -d @MoviesExample.json

Notes

On Android emulator, you must open a port mapping with adb reverse tcp:4984 tcp:4984 to make the Sync Gateway accessible from the Couchbase Listener.

rncouchbaseexample's People

Contributors

jmn8718 avatar jamesnocentini avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.