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.
- Clone this repository.
- Create a Pusher app.
- Enter your Pusher app information in
server/server.js
and inclient/src/App.js
. - In a terminal window, start MongoDB as a replica set of one server with the command:
mongod --dbpath <DATA_PATH> --replSet "rs"
. - In a separate terminal window, run
mongo
, the MongoDB client. - If this is the first time you set up a replica set, execute the command
rs.initiate()
. - Create the database
tasksDb
(use tasksDb
) and the collectiontasks
(db.createCollection('tasks')
). - In a separate terminal window,
cd
into theserver
directory and executenpm install
to download the dependencies and then,npm start
to start the server. - In a separate terminal window,
cd
into theclient
directory and executenpm install
to download the dependencies and then,npm start
to start the app. - A browser window will open, you can open another one to see how the task are replicated in realtime.
- MongoDB - NoSQL database
- Node.js - A JavaScript runtime
- React - A JavaScript library for building webapps
- Pusher - APIs to enable devs building realtime features
- Thanks to Pusher for sponsoring this tutorial.
MIT