前端框架选型是企业提升开发效率与用户体验的关键因素
496
2022-10-23
Lovlijs 让你在几分钟内开发实时应用程序
lovli.js
A starter kit which allows you to develop realtime applications in minutes.
Demo: lovli.neschkudla.at
Stack
facebook/react - Viewrethinkdb/horizon - Realtime Database Syncflipace/horizon-react - Connect View + Datagaearon/react-hot-loader - Hot Reloading of React Componentswebpack/webpack - Builds & Dev-Server
Installation
$ git clone --depth=1 https://github.com/flipace/lovli.js$ cd lovli.js$ npm i
You'll need to have RethinkDB running.
Run
$ npm start # starts app in dev mode$ npm run prod # starts server in production mode$ npm run build # builds source files in .build/$ node .build/server.bundle.js # starts server (after you built with npm run build)
This will start a server listening on port 3000. You can change the port in config/page.js or by setting the PORT environment variable.
Configure horizon
If you want to configure the props for the horizon client, you can do that by passing a configuration object as the first parameter to HorizonConnector() in source/client/containers/Root.js and the target element as the second parameter.
The props you provide there will be passed to horizon().
FAQ
How to add vendor scripts and css?
If you want to add any vendor javascript or css, you'll likely not want it to be processed by babel or localized by css loader.
Add these scripts to the static/vendor folder and they will use a different loader configuration.
How to configure data subscriptions?
Check out flipace/horizon-react for documentation of the horizon-react subscribe function.
Why won't the server reload?
The server won't hot reload. It would be possible to implement a restart on file change though.
Contributing
Pull Requests are very welcome!
If you find any issues, please report them via Github Issues!
License
(MIT)
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~