GithubHelp home page GithubHelp logo

mehdiparastar / realtime-mongodb-pusher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eh3rrera/realtime-mongodb-pusher

0.0 1.0 0.0 102 KB

Sample app that shows how to use MongoDB change streams and Pusher in a Node.js/React app

License: MIT License

HTML 11.93% CSS 12.04% JavaScript 76.03%

realtime-mongodb-pusher's Introduction

realtime-mongodb-pusher

React application that allows you to add and delete tasks. It communicates to an API implemented in Node.js that saves the changes to a database. The Node.js script also receives these changes using change streams, parsing them and publishing them to a Pusher channel so the React application can consume them.

Follow the tutorial here.

Getting Started

  1. Clone this repository.
  2. Create a Pusher app.
  3. Enter your Pusher app information in server/server.js and in client/src/App.js.
  4. In a terminal window, start MongoDB as a replica set of one server with the command: mongod --dbpath <DATA_PATH> --replSet "rs".
  5. In a separate terminal window, run mongo, the MongoDB client.
  6. If this is the first time you set up a replica set, execute the command rs.initiate().
  7. Create the database tasksDb (use tasksDb) and the collection tasks (db.createCollection('tasks')).
  8. In a separate terminal window, cd into the server directory and execute npm install to download the dependencies and then, npm start to start the server.
  9. In a separate terminal window, cd into the client directory and execute npm install to download the dependencies and then, npm start to start the app.
  10. A browser window will open, you can open another one to see how the task are replicated in realtime.

Prerequisites

Built With

  • MongoDB - NoSQL database
  • Node.js - A JavaScript runtime
  • React - A JavaScript library for building webapps
  • Pusher - APIs to enable devs building realtime features

Acknowledgments

  • Thanks to Pusher for sponsoring this tutorial.

LICENSE

MIT

realtime-mongodb-pusher's People

Contributors

eh3rrera avatar

Watchers

James Cloos 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.