I'm currently trying to make a turn-based game for a class project using gameboard.io. My biggest issue is I don't know how to set up my folder structure with react and MongoDB as its a new technology I've been using.
I've tried a couple of different things but every time I try to use mongoDB I get loads of errors and files missing/not connecting and I'm sure my folder structure is broken.
Can anyone help me with an outline for a folder structure using those technologies? I know this isn't a typical question but I've been struggling with this. Any help would be appreciated, thank you.
Normally mongoDB runs on the back-end. Your front-end application would interact with mongo through an api. If you want to use a node.js powered back-end server application, express is a popular choice, but there are many others ( koa, hapi, Meteor, ...to name a few).
Then install mongoDB on (not the npm package but the server application, the npm package is the mongoDB driver that you use in your application to connect to the database, you will find instructions on mongoDB's website), I would also recommend installing mongoose, it's an object data modeling library.
If I where you, start with installing express, and work on communicating with express from your react app. Then install mongo/mongoose, and give it a try.
Related
Hello I’ve been working with Freelance developer for over 10 months developing a Project developer abandon the project one day to the next ghost me disappeared. Send me a file with the work he has done, but I’m missing a backend API
Architecture: (full project is NodeJS in Typescript)
Backend: Express API, Sequelize
Frontend: React 18
My question is there is anyway to recrive the files from the file manager from the server ? Or any other place
Currently, the website is live and working how would I be able to retrieve the files?
I truly appreciate it of anybody has any insight thank you
Unfortunately, the only way to get those missing files is if you or someone you know has access to the server where they are located.
Otherwise, all you can do is look at all frontend API calls to try and reverse-engineer the API based on: the data payload React sends, the URL it hits, the method it uses (GET, POST, etc) and the response it gets from the server currently.
Then you would be left with creating the end-point handlers inside of Express, and the logic for the database such as queries and models. It's a difficult task but you can do it if you look at enough of the other information you have available. Good luck and welcome to Stackoverflow!
i have got a problem, which i am trying to find a solution for weeks now.
I think it´s an understanding error on my side, but i couldn't figure it out.
What i am trying to do:
Develop, not deploy, a react app on an Apache2 server.
I know that react is an frontend library, so it should be possible to do.
I also know that nodeJs is kinda required to "npm" all the packages and to create the "Simple" react app..
What i want also to do:
Use the MATERIAL-UI
Build a PHP Backend
Collaborate with my Team Members (they should also work on the react app)
Thanks in advance.
Hosting a ReactJS App is no different than hosting any other javascript code on any type of server - by having it as a static file on your web server and including it in the html returned from the server.
Depending on the way your React project is set up, you would:
use node to build a javascript bundle of your react app (possibly by running "npm run build" in any CLI),
include the resulting script file or files in the head element of your root or master template
Make the Apache web server return the needed page with the master template where the script tag is
Additional setup could include starting the PHP server and react development build at the same time, but that is highly specific on your setup and would require you to add some more information on used frameworks and setup.
It is not possible to deploy apps with Apache and React. The nodejs based- Webpack server is incompatible with Apache web server. You'll have to pick one server or another, you can not route index.html -> index.tsx and vice versa. Besides if you ever got both servers working in tandem with SSL, it's a technically security nightmare and has no production value. It's best to avoid java(script) all together as it's merit in real software development has greatly diminished. Mostly for gold diggers.
Some years ago I implemented a websocket (Ruby based) on a intranet website to create a one direction message system. Admin types a message and all the clients that are registered on that channel get the message.
It is working well but now that I'm approaching REACTJS I am thinking about replacing the Ruby websocket with a React component.
Starting from an Apache webserver running php and a Ruby websocket in parallel to it what do I have to do to set up an environment running react?
Install Node on Ubuntu?
Install NPM?
What else?
On react side I'm currently learning the basics and I have not approached yet the differences in terms of application beside a compiled app and the dev version. So I expect that also the compiled version will require the same environment as when I am developing. Am I right?
React is solely a front-end/client-side technology, so it has very little to do with the server.
If you develop a React app using something like create-react-app, the development environment they provide allows you to disregard the backend/server-side while you develop. It does this by serving the files on a local webserver.
If you have a server that makes a web socket available, your React component can connect to it and use it.
After development the React code must be transpiled, and all you need is to serve the static files. For example you might end up with a chat.html file that uses styles.css and connect.js, and you'll need a server to respond to requests for those files.
So I would say that if you already have an exposed web socket, you do not need a new production environment on your server.
*If you intend to build a new websocket on Node or if you need to build yourself an additional REST API that's going to require setting up a Node environment on your server*
I completed an online React course and deployed my application to Heroku. During development, I used the 'json-server' module found at https://github.com/typicode/json-server. This served up a folder on my computer which contained a simple json file and a few images for my website while conforming with the REST API. What do I need to do to get the server to operate independently of my machine so that my application can fetch the data ? I have zero experience doing this.
if you mean you want to create a server for your site,
first of all, you need to get a server, which can run nodejs , then you need to deploy and run your JSON server via a nodejs(express) app.
then you can connect to your server via your website/app
in order to do these things, you can follow tutorials
there are lots of tutorials about it.
hope you got the idea.
I have to install Piwik (now Matomo) analytics tool in an AngularJS project. I am using windows and I have to do it in my local environment. I am an absolute noob in this backend stuff So, cannot figure out how to proceed.
The brief idea that I have got till now is that I'll have to use node.js with express.js to setup the local server. Also, I have to use mySQL along with it to store the data.
So, my question is that how can I do the same? Any relevant resources will be really helpful.