GithubHelp home page GithubHelp logo

spravo / typescript-react-express Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 6.0 45 KB

typescript react express example

TypeScript 67.53% CSS 0.31% JavaScript 32.16%
express react typescript server-side-rendering webpack3 redux hot-module-replacement

typescript-react-express's Introduction

Typescript React Redux Isomorphic Hot Example.

About

This is a starter boilerplate app I've put together using the following technologies:

  • React
  • React Router
  • Express
  • Typescript
  • Webpack for bundling
  • Webpack Dev Middleware
  • Webpack Hot Middleware
  • Redux's futuristic Flux implementation
  • Support ReduxDevTools (developer experience)
  • TSLint to maintain a consistent code style
  • style-loader, sass-loader and autoprefixer to allow import of stylesheets in plain css, scss,
  • react-helmet to manage title and meta tag information on both server and client

Feature:

  • Support docker
  • Server side render + fetch data
  • React hot reload
  • Server render supports react hot reload
  • Server does not reload after change client code

How to use

$ npm run docker:run

# Connect to docker container
$ npm run docker:exec

# NOTE. After work you should stop container
$ npm run docker:stop
# Developer mode
$ npm run start

$ npm run build
$ npm run server
# TSLint
$ npm run tslint

# Unit test
# TODO

Explanation

Client side

The client side entry point is reasonably named client/index.ts. All it does is load the routes, initiate react-router, rehydrate the redux state from the window.__PRELOADED_STATE__ passed in from the server, and render the page over top of the server-rendered DOM. This makes React enable all its event listeners without having to re-render the DOM.

Server-side Data Fetching

...

Routing and HTML return

...

TODO:

  • Storybook
  • test (mocha, chai, chai-http, enzyme, sinon, jsdom)
  • webpack/plugins/assetsManifest.js
  • Dockerfile

typescript-react-express's People

Contributors

spravo avatar

Stargazers

 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.