https://github.com/lsongdev/kelp-ssr
Simplify Server-side Rendering
https://github.com/lsongdev/kelp-ssr
server server-side-rendering web
Last synced: 7 months ago
JSON representation
Simplify Server-side Rendering
- Host: GitHub
- URL: https://github.com/lsongdev/kelp-ssr
- Owner: lsongdev
- License: mit
- Created: 2019-09-17T04:05:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-14T04:55:55.000Z (over 5 years ago)
- Last Synced: 2025-08-29T21:41:51.869Z (7 months ago)
- Topics: server, server-side-rendering, web
- Language: JavaScript
- Homepage: https://npmjs.org/kelp-ssr
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## kelp-ssr
> simplify server side rendering
### Installation
```bash
$ npm install kelp-ssr
```
### Example
```js
const http = require('http');
const React = require('react');
const ssr = require('kelp-ssr');
const MyApp = ({ name = 'world' }) => {
return
Hello { name }
};
const { SERVER, DATA, SCRIPT } = ssr.modes;
http.createServer((req, res) => {
const state = {
name: 'myapp'
};
const html = ssr(MyApp, state, {
renderingMode: SERVER | DATA | SCRIPT
});
res.end(html)
}).listen(3000);
```
### Contributing
- Fork this Repo first
- Clone your Repo
- Install dependencies by `$ npm install`
- Checkout a feature branch
- Feel free to add your features
- Make sure your features are fully tested
- Publish your local branch, Open a pull request
- Enjoy hacking <3
### MIT
This work is licensed under the [MIT license](./LICENSE).
---