How to add react js to Parseserver using parse js

388 views
Skip to first unread message

Edo

unread,
Nov 29, 2016, 12:17:09 PM11/29/16
to NodeChef
I would like to add react js to my parse server express app. How would I go about setting that up on node chef.

Plus could this also apply to other JavaScript frameworks?

Thanks

dev.no...@gmail.com

unread,
Nov 30, 2016, 7:49:58 AM11/30/16
to NodeChef
If your react app compiles to just static assets. You can simply use the deploying static assets to deploy. What do you currently have as your setup locally? create-react-app?

Edo

unread,
Nov 30, 2016, 8:13:35 AM11/30/16
to NodeChef
So I currently have react running in a separate node app. My parse server is still running express.

Am currently stuck on how I would run the react app in my parse server. What setting I need to do and if you could just send me a sample or walk me through how I would go about setting up a react app or any other JavaScript framework to work with my parse server. How would I use the parse js or would have be using the REST API.

What about logins and authentication. These are somewhat new to me in set up.

Thanks

dev.no...@gmail.com

unread,
Nov 30, 2016, 12:28:34 PM11/30/16
to NodeChef
In your node app, what server framework are you using?. You can reference any framework in your Parse Server cloud code as well. Reference the documentation under working with npm modules.

Edo

unread,
Nov 30, 2016, 1:46:33 PM11/30/16
to NodeChef, dev.no...@gmail.com
I am using Express Server. 

Am a bit confused on how I would get react to work with this. 
Here is what my file structure looks like on my local machine. 
-cloud
--app,js 
--jobs.js
--main.js
--package.json
---node_modules 
---public
---views

How would I go about setting up React to work with this?
What do I need to do to my app.js? 
Should I be creating a whole new React app in the public folder? If so what are the setting i need in order to make that work. 

Am really new to all this so a bit of a walk through or documentation link or sample code would go a long way.
Thanks 

dev.no...@gmail.com

unread,
Nov 30, 2016, 3:09:15 PM11/30/16
to NodeChef, dev.no...@gmail.com
Once you build your react frontend, you can keep the files in the public folder. You can then deploy the static assets in the public folder following this documentaiton: https://www.nodechef.com/docs/parse-server/global/statics


Edo

unread,
Nov 30, 2016, 3:28:17 PM11/30/16
to NodeChef, dev.no...@gmail.com
Thanks. I will try that. 
One more question. What about the node modules. I assume that i will create a new one in the Public folder. Essentially treating this as a contained web app? 

dev.no...@gmail.com

unread,
Nov 30, 2016, 3:33:26 PM11/30/16
to NodeChef, dev.no...@gmail.com
The static assets will not depend on the node_modules so those can be left out. Only the server code depends on them.

Edo

unread,
Nov 30, 2016, 3:38:43 PM11/30/16
to NodeChef, dev.no...@gmail.com
That I understand, my question was more on the modules installed for React. So with this react folder structure. 
You are saying that I would drop this into the public folder as is? 
My confusion is the public folder already has files and folders do I override this or can i create another folder within the public folder called my-app and install the React app? 
my-app/
  README.md
  node_modules/
  package.json
  .gitignore
  public/
    favicon.ico
    index.html
  src/
    App.css
    App.js
    App.test.js
    index.css
    index.js
    logo.svg

dev.no...@gmail.com

unread,
Nov 30, 2016, 3:47:06 PM11/30/16
to NodeChef, dev.no...@gmail.com
The modules installed for React are mainly for building the react project into its final state which can then be deployed into production. You do not have to push those modules into production as well.

Edo

unread,
Nov 30, 2016, 3:52:59 PM11/30/16
to NodeChef, dev.no...@gmail.com
So you saying I do not have to upload the node_modules in the folder structure? 
What if added my own modules to the node_modules should that also be ignored. 

I know we going back and forth with this. Any chance you have a folder structure or documentation that works with React js/Angular js/Auriela js or any other javascript framework that works and can be used with nodechef. 

dev.no...@gmail.com

unread,
Nov 30, 2016, 4:03:55 PM11/30/16
to NodeChef, dev.no...@gmail.com
I am assuming you are performing server side rendering using react then?

If that is the case then it comes back to the initial document i sent you about working with npm modules. Once the module is installed in your folder, just deploy and it will pick it up on the server as well.

Are you able to even deploy any cloud code at all on NodeChef which uses npm modules? When you mention setting up react to work this just reference the react module and performing the .jsx rendering and simply write the result to express. We currently do not have an example project but there are many example projects on github you can check out how to handle this.

dev.no...@gmail.com

unread,
Nov 30, 2016, 4:08:37 PM11/30/16
to NodeChef, dev.no...@gmail.com
Using this project as an example, you can adopt it to nodechef parse server cloud code as well.


Under the project, everything in the server project will apply to your cloud as well except the last line where you call app.listen. This is already called on your behalf so you do not have to do this.

Edo

unread,
Nov 30, 2016, 4:10:31 PM11/30/16
to NodeChef, dev.no...@gmail.com
Am not doing React on the server. 
Yes I deployed and used nmp_modules in the cloud code. so am aware of the process. 

My confusion was just on writing web apps and how to set that up since I couldn't find any documentation on how to do that. Thanks for your help. 
I will go ahead and try some of your suggestions and see where that takes me. 

Maybe in the future if you guys could have some documentation on how to get started with a web app using one of the javascript frameworks. Am mainly a mobile developer so am pretty sure some folks out there have the same question

Edo

unread,
Nov 30, 2016, 4:19:19 PM11/30/16
to NodeChef, dev.no...@gmail.com
Just saw this. This is helpful.
Thanks

dev.no...@gmail.com

unread,
Nov 30, 2016, 7:54:13 PM11/30/16
to NodeChef, dev.no...@gmail.com
Sounds good. Will look into putting something up.
Reply all
Reply to author
Forward
0 new messages