Giter Club home page Giter Club logo

react-ssr's Introduction

React SSR

Delightful React Server-Side Rendering

React SSR

这是基于ReactReact-RouterReduxKoa2.0实现的React服务端渲染方案。为了更好的演示,已实现一个简单的电影首页、电影详情页。 数据资源是豆瓣上的资源。样式也参考了豆瓣的样式

快速上手

// 安装依赖
npm install

// 为了构建一个模板(dist/index.html)给koa模板引擎使用
npm run build:local

// 启动本地node服务器,这里设置的端口是4322
npm run server:dev

// 启动前端服务,这里的服务端口号是8088
npm start

// 访问 http://localhost:4322进行开发

功能预览

目前已实现首页、详情页的交互和相关接口

首页:(直接访问时,会走服务端渲染出首页dom,浏览器右键可以查看源码)
http://localhost:4322

详情页:(直接访问时,会走服务端渲染出详情页dom,浏览器右键可以查看源码)
http://localhost:4322/detail/30163509

api接口:
http://localhost:4322/api/home
http://localhost:4322/api/movie/30163509

实现原理

如果你想查看更多原理内容,可以看我的知乎。

React SSR 实现原理

首页预览 和 浏览器源码

访问 http://localhost:4322

详情页预览 和浏览器源码

react-ssr's People

Contributors

coocssweb avatar

Watchers

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