# Srejs **Repository Path**: sync-github/Srejs ## Basic Information - **Project Name**: Srejs - **Description**: Server rendering engine 缩写为 srejs 即服务器端渲染引擎,为React,Vue提供轻量级封装的服务端渲染骨架。提供了类似模板引擎一样的用法用于在Koa框架中使用。 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: main - **Homepage**: https://github.com/dazjean/Srejs - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-11-17 - **Last Updated**: 2021-11-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Server rendering engine, abbreviated as srejs, is the server-side rendering engine. It provides the simplest and most flexible react and Vue lightweight server-side rendering skeleton tool for each node development framework, and supports the use in any koa framework.

react vue License Node

> Server rendering engine 缩写为 Srejs, 即服务器端渲染引擎,为各个node开发框架提供最简单,最灵活的React,Vue轻量级服务端渲染骨架工具,支持在任何koa框架中使用。 ## Development ```shell yarn install cd packages/app && npm start // 开发调试react cd packages/app-vue && npm start // 开发调试vue ``` ## Feature - 🚀 支持SSR和CSR模式切换 - 🚀 数据管理支持redux,useContext+useReducer - 🚀 服务端数据初始化 - 🚀 搭配react-router使用,不局限服务端路由,可动态修改baseName - 🚀 自定义HTML和SEO - 🚀 vue2.0 - 🚀 vuex - 🚀 vue-router - 🚀 单页面应用和多页面应用 - 🚀 页面级构建更新 - layout - vue3.0+vite ## Client ```ts //web/pages/index/index.ts import React from 'react' export default function (props:any) { const { title } = props return
{title}
} ``` ## Server ```js import koa from 'koa'; import srejs from '@srejs/react'; // import srejs from '@srejs/vue'; const app = new koa(); const Sre = new srejs(app,process.env.NODE_ENV != 'production',false); app.use((ctx,next)=>{ Sre.render(ctx,'index',{title:'标题'}) }) app.listen(8001); ``` ## Quikstart - [react](https://github.com/dazjean/Srejs/tree/main/packages/core-react) - [vue](https://github.com/dazjean/Srejs/tree/main/packages/core-vue) ## [MIT License](./LICENSE)