🏁 Prologue
🆕 Make a new directory. Let's call it react-boilerplate.
mkdir react-boilerplate
And cd into it.
cd react-boilerplate
Mak...
For further actions, you may consider blocking this person and/or reporting abuse
Big thanks to you and this tutorial :) really helped me!
Just saying, I had an small issue doing 3.3 React + Express.
I don't know if it's because of my node/express/react.. version but in the server/index.js file, I had to add
const path = require('path');
so that the path is defined.And everything is working now :D
Here are my (dev)Dependencies:
and the node version : v12.4.0
I am very glad that this article helped you. :)
You are so right. I dont know how I missed that. I do have the
path
defined in my project code. Not sure how I did not copy it over.I will edit the article to include it.
Thanks again :)
Great article!
What should I edit if I want to associate other URLs to other .js files? For example, localhost:3000/test would load a test.js component...
Thanks Andrea.
If you want to do exactly that (i.e. pointing /test to the test.js file),
in the file server/index.js, add:
Make sure the Express JS version you are using (in package.json), is 4.8.0 or higher. Or else,
sendFile
wont be supported.If you need that because you need the .js files for your code and dont need to expose it publically, I would recommend to let webpack take care of it.
I'm sorry, maybe I wasn't clear: what I would like to do is render the content of another component (for example a component Test, located in test.js, and indipendent from Index) inside the div in index.html (or if possible, another html file called test.html).
Writing what you said in your reply, the result is the whole code inside test.js.
Thank you, I was looking for this kind of tutorial last week but using Vue instead.
You're welcome.
Hope it helps.
Wow this is a great article. It gave a good intro to everything I needed in one single article. Thanks a lot
Thank you so much!!!
I think you can combine Express JS and dbdesigner.id as your database designer. This can make your project readable and clear documentation.
You might want to move express.static statement below all the routing calls.
in express the order matters. app.get calls wont get called if the static call serves the get request
Wow!! Amazing. :)
It works well.
well, explanatory article, good covering all parts especially the src/components and every index.js one!
What a great way of explaining things! keep it up.
can we use it with react-router? any configuration changes needed?
Thanks ckcnair.
react-router is a package that provides core routing functionality. Of course, you can use it. Like many other packages.
Configurations will be needed. It depends on the way you'd like to use it.
So much tooling for so little business value.