riseres riseres - 29 days ago 11
React JSX Question

How to build react SPA with GunDb on nodejs

I really like concept of GunDb, and understand how to write in client side alone.

Now I use Create-React-App from Github.

Dose anyone know server side for GunDb?

and a View [React Gun library] ; example 'socket.io-client' So I can run es6 in Node then webpack to use it.

Answer

@riseres great question! If I understand you right, your question is two parts?

First, how to use GUN with React and Webpack and ES6? Here is a very simple React todo-app that might help:

https://github.com/gundb/todo-react

As far as using gun with Webpack, please require('gun/gun') on the client side for now. ES6 should work fine with gun.

Second, how to use GUN in NodeJS? Very similar to how you use GUN on the client! But here are some examples that might be more helpful:

Using express: https://github.com/amark/gun/blob/master/examples/express.js , using plain HTTP: https://github.com/amark/gun/blob/master/examples/http.js . There is also a an easy NPM utility as well: https://www.npmjs.com/package/gun-server .

I am not sure if this answered your question though? Could you update the question with more details for answers/solutions you are looking for? Also, many people in the gun community use React, Webpack, ES6, who can also help with more detailed answers (I haven't used React yet so my answer is not as good).

Let me know if this helps? I feel like it only half-way answers your question.

Update: In case it is helpful, here is a starter app boilerplate: https://github.com/gundb/gun-starter-app for gun.