Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/djyde/serlina
A progressive React serverside-rendering framework.
https://github.com/djyde/serlina
react serverside-rendering ssr
Last synced: about 1 month ago
JSON representation
A progressive React serverside-rendering framework.
- Host: GitHub
- URL: https://github.com/djyde/serlina
- Owner: djyde
- License: mit
- Created: 2018-08-02T17:17:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-02T05:37:25.000Z (about 4 years ago)
- Last Synced: 2024-07-11T05:33:18.587Z (2 months ago)
- Topics: react, serverside-rendering, ssr
- Language: TypeScript
- Homepage: https://serlina.js.org
- Size: 182 KB
- Stars: 138
- Watchers: 8
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - djyde/serlina - A progressive React serverside-rendering framework. (TypeScript)
README
![logo](https://cdn.nlark.com/yuque/0/2018/png/84329/1533482375370-fc24dd8f-9cf5-46bd-b8ca-8b7cdf43be83.png)
[![npm](https://badgen.net/npm/v/serlina)](https://npm.im/serlina)
[![downloads](https://badgen.net/npm/dt/serlina)](https://npm.im/serlina)
[![CircleCI](https://circleci.com/gh/djyde/serlina.svg?style=shield)](https://circleci.com/gh/djyde/serlina)A progressive React serverside-rendering framework.
## Motivation
I love using [Next.js](https://github.com/zeit/next.js/), but most of my projects need to use our own web server framework while Next.js run it own server. So I begin making a SSR framework (core) that like Next.js but open for server implementation. It does all the building, compiling, rendering-to-string things and give the rest render-to-html things to your own web server.
> Of course I know Next.js can [custom server and routing](https://github.com/zeit/next.js#custom-server-and-routing), but while Next.js handle the whole http `context`, [I cannot use it in a high layer web framework](https://github.com/eggjs/egg/issues/328).
[Read the announcing post](https://medium.com/@djyde/serlina-a-progressive-react-serverside-rendering-framework-a4de2d71d984)
## Integrations
- [egg-serlina](https://github.com/serlina-community/egg-serlina)
- [serlina-koa](/packages/serlina-koa/README.md)
- [serlina-serve](/packages/serlina-serve/README.md)## Quick Start
```
npm i serlina react react-dom --save
```Create a folder structure like:
```bash
├── index.js
├── pages
│ └── page1.js
``````js
// pages/page1.jsexport default () => {
returnHello Serlina!
}
```And implement a most simple http server:
```js
// index.jsconst { Serlina } = require('serlina')
const path = require('path')const http = require('http')
const serlina = new Serlina({
baseDir: path.resolve(__dirname, './')
})serlina.prepare()
.then(() => {
http.createServer(async (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/html' })
if (req.url === '/page1') {
const rendered = await serlina.render('page1')
res.write(rendered.body)
} else {
res.write('works!')
}
res.end()
}).listen(8090)
})
.catch(console.error)
```Open `http://localhost:8090/page1`, you will see the page you wrote in React!
## Documentation
Visit [Full Doc](https://serlina.js.org)
## Who is using?
Please create an issue or PR to tell us you are using Serlina!
## Development
```bash
npm run bootstrapnpm test # run test
```# License
MIT License