Giter Club home page Giter Club logo

sc-crud-sample's Introduction

sc-crud-sample

Scroll to the bottom for installation instructions.

A sample inventory tracking realtime single page app built with SocketCluster (http://socketcluster.io/), VueJS and RethinkDB. It demonstrates a way of building realtime apps.

All code for the server-side worker logic is linked from worker.js - It's mostly generic so feel free to reuse/modify for your own app or you can use this app as a base to build yours if starting from scratch.

Aside from SocketCluster, VueJS and RethinkDB, this sample app uses the following modules:

This sample app aims to demonstrate all the cutting edge features that one might want when building a realtime single page app including:

  • Authentication (via JWT tokens)
  • Access control using backend middleware
  • Reactive data binding
  • Realtime REST-like interface
  • Pagination with realtime updates

Keep in mind that this app is optimized for cutting-edgeness, not for backwards compatibility with older browsers.

To make the most of this demo, you should open the web app in two different tabs/windows/browsers and make updates to the data in realtime.

Installation

To setup and run this sample:

  • Make sure you have Git installed (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
  • Make sure you have Node.js installed (http://nodejs.org/)
  • Make sure you have RethinkDB installed (https://www.rethinkdb.com/)
  • Run git clone https://github.com/SocketCluster/sc-crud-sample.git
  • Run cd sc-crud-sample (to navigate to the sc-crud-sample/ directory)
  • Run npm install (to install back end modules)
  • Run cd public && npm install && cd .. (to install front end modules inside the public/ directory)
  • In a different terminal (or in the background), run sudo rethinkdb (make sure RethinkDB stays running)
  • Run node server (to launch the server)
  • In your browser, go to http://localhost:8000/

sc-crud-sample's People

Contributors

jondubois avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sc-crud-sample's Issues

How to make this use OAuth with Github

Thank you for the sample.

Currently the user 'bob' is hardcoded inside the code. Instead, if I want to make users "signup" with github or similar oAuth providers, how to make it happen? Which parts need to be changed?

worker repeatedly crashing (?) / respwaning

Fresh installation. After logging in (with default populated 'bob' username and password), whenever we go into the any of the listed categories, the console is populated with so many errors (Screenshot below), as well the server is dumping below errors

1469169722225 - Origin: Worker (PID 9544)
   [Error] TypeError: Cannot read property 'category' of null
    at crudOptions.schema.Product.views.categoryView.transform (e:\Codebase\sc-sample-inventory\worker.js:65:78)
    at module.exports.constructTransformedRethinkQuery (e:\Codebase\sc-sample-inventory\node_modules\sc-crud-rethink\query-transformer.js:24:20)
    at SCCRUDRethink.read (e:\Codebase\sc-sample-inventory\node_modules\sc-crud-rethink\index.js:308:26)
    at Emitter.<anonymous> (e:\Codebase\sc-sample-inventory\node_modules\sc-crud-rethink\index.js:641:10)
    at Emitter.emit (e:\Codebase\sc-sample-inventory\node_modules\component-emitter\index.js:131:20)
    at Emitter.SCEmitter.emit (e:\Codebase\sc-sample-inventory\node_modules\sc-emitter\index.js:28:26)
    at e:\Codebase\sc-sample-inventory\node_modules\socketcluster-server\scsocket.js:113:44
    at e:\Codebase\sc-sample-inventory\node_modules\socketcluster-server\scserver.js:666:11
    at e:\Codebase\sc-sample-inventory\node_modules\socketcluster-server\node_modules\async\lib\async.js:52:16
    at e:\Codebase\sc-sample-inventory\node_modules\socketcluster-server\node_modules\async\lib\async.js:269:32
    at e:\Codebase\sc-sample-inventory\node_modules\socketcluster-server\node_modules\async\lib\async.js:44:16
    at e:\Codebase\sc-sample-inventory\node_modules\sc-crud-rethink\filter.js:49:13
    at mustBeLoggedIn (e:\Codebase\sc-sample-inventory\worker.js:93:7)
    at Object.<anonymous> (e:\Codebase\sc-sample-inventory\node_modules\sc-crud-rethink\filter.js:40:9)
    at e:\Codebase\sc-sample-inventory\node_modules\socketcluster-server\node_modules\async\lib\async.js:1165:24
    at iterate (e:\Codebase\sc-sample-inventory\node_modules\socketcluster-server\node_modules\async\lib\async.js:262:13)
1469169722290 - Worker 0 exited - Exit code: 1
   >> Worker PID: 13260
Creating a pool connected to 192.168.99.100:28015
1469169722936 - Worker 0 was respawned

image

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.