Giter Site home page Giter Site logo

molily / universal-progressive-todos Goto Github PK

View Code? Open in Web Editor NEW
30.0 2.0 2.0 3.28 MB

A Todo list with universal JavaScript & Progressive Enhancement

Home Page: https://molily.de/single-page-apps/

License: Other

JavaScript 90.51% SCSS 3.73% Sass 4.14% EJS 1.62%
javascript progressive-enhancement universal-javascript todomvc react redux leveldb preact isomorphic universal-react

universal-progressive-todos's Introduction

Todo list with universal JavaScript & Progressive Enhancement

This example app renders HTML on the server and on the client using “universal” JavaScript. It uses Node.js, React, React-Router and Redux for the rendering and the UI logic. For storing the todos on the server, it uses the key-value database LevelDB.

There’s also a Preact version available in the preact branch if you prefer that over React.

There are several good example apps and boilerplates for universal React/Preact apps. This one borrows ideas from Milo Mordaunt’s great tutorial: Handcrafting an Isomorphic Redux Application (With Love) and the corresponding repository.

What’s special about this example is that it’s made with Progressive Enhancement in mind. Instead of just rendering the first page on the server to improve the JavaScript application’s startup time, this example works entirely when JavaScript is disabled or fails for any reason. See these articles for background information:

When it comes to data fetching, this example follows Milo Mordaunt’s approach. It declares the data dependencies in the React/Preact component. The static component property needs lists Redux action creators.

These action creators directly talk to the database when called on the server, or make a request to the server when called on the client. It gets simpler if you use a separate HTTP REST API server that speaks JSON. Then you can use a universal HTTP library like axios or fetch to talk with the API server. In this simple example though, everything is mashed up on purpose.

Development server

Start the development server with:

$ npm install
$ npm start

Then open http://localhost:3333 in your browser.

Production server

Make a client and server production build:

$ npm run build

Start the server with:

$ npm run server:production

Then open http://localhost:3333 in your browser.

universal-progressive-todos's People

Contributors

dependabot[bot] avatar molily 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

Watchers

 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.