Giter Site home page Giter Site logo

jpdevries / synctodo Goto Github PK

View Code? Open in Web Editor NEW
9.0 5.0 0.0 148 KB

Progressively Enhanced React To Do List

License: MIT License

JavaScript 90.66% HTML 4.26% CSS 5.08%
react postgres progressive-enhancement a11y server-side-rendering node express redux html5

synctodo's Introduction

Sync To Do

Progressively Enhanced React To Do List. HTML–first, Node, Express, PostgreSQL.

Preview

Have a look at the synchronous and asynchronous endpoints in action. Run the live demo at our Heroku Dino.

What you need

Install the grunt-cli package if you haven't before. This should be done as a global install:

npm install -g grunt-cli

Make sure you have grunt installed by testing:

grunt --version

To interact with the application you'll need to be running PostgreSQL for the database. Install Postgres if you haven't already. Mac users can install Postgres via brew.

Create a synctodo database.

psql
CREATE DATABASE synctodo;
\q

Next import our example data. Data will be imported into a tasks table.

psql synctodo < _build/db/synctodo.sql

Getting Started

First, clone a copy of this git repo by running:

git clone -b grunt [email protected]:jpdevries/synctodo.git

Then cd into the synctodo folder and install the Node dependencies:

cd synctodo
npm install

You should now be able to build the files and run the Node server!

grunt build
npm run serve

The server will automatically restart when changes are made. To watch the Sass source files for changes and automatically rebuild the source files, run the grunt command:

grunt #alias for grunt watch

By default this project runs on port 1187. To run it on a different port use the PORT environmental variable:

PORT=8081 npm run serve #visit http://localhost:8081 in your browser

To use a database with a different name use the PGDATABASE environmental variable:

PGDATABASE=anotherdb npm run serve

Features

  • Add, Complete, Archive, and Delete Tasks
  • Progressive Enhancement (.no-js) support
  • Isomorphic HTML layer doubles as a data model for Redux
  • Isomorphic server uses the same promises for asynchronous and synchronous requests
  • React Routing
  • React and Redux used on both server and client side
  • REST API prefetches and fetches data to keep UI fresh
  • Loads dependencies from CDN with local fallback
  • Feature detection to only load scripts if they'll work (IE9+)

Add New Tasks

Homepage at /
Asynchronously posts to /api/tasks

Complete Tasks

Synchronously posts to /
Asynchronously posts to /api/tasks

Archive Tasks

Synchronously posts to /archive
Asynchronously posts to /api/tasks

Unarchive Tasks

Synchronously posts to /
Asynchronously posts to /api/tasks

Delete Tasks

Synchronously posts to /delete/tasks
Asynchronously posts to /api/tasks

Database

A simple PostgreSQL database schema is used to store our tasks. See server.js for the queries that interact with the database to add, complete, archive, unarchive, and delete tasks.

CREATE TABLE "tasks" (
  id SERIAL PRIMARY KEY,
  title varchar(255) NOT NULL DEFAULT '',
  completed smallint NOT NULL DEFAULT '0',
  archived smallint NOT NULL DEFAULT '0'
);

Accessibility Proclaimer

This component strives for WCAG 2.0 Guidelines Level AA. Please open an issue for any accessibility issue, feedback, or concern.

synctodo's People

Contributors

jpdevries avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.