mern-app | Recently learnt react , thought I would make | Frontend Framework library
kandi X-RAY | mern-app Summary
kandi X-RAY | mern-app Summary
Recently learnt react, thought I would make a MERN stack app
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mern-app
mern-app Key Features
mern-app Examples and Code Snippets
Community Discussions
Trending Discussions on mern-app
QUESTION
I have reactjs app and express app dockerized.
This is my docker-compose.yml file:
ANSWER
Answered 2021-May-08 at 20:53When you go to your browser and type http://localhost:3000
in, the browser makes a call to the client
container, does an HTTP GET to retrieve the Javascript code, and the browser actually runs the code. This is a critical difference: any fetch
calls or similar from your React application are running in the end user's browser, not inside Docker.
If a call is coming from the browser; it is part of your front-end application; or it is otherwise coming from outside Docker, then you need to use the host system's DNS name and the first published ports:
number. If the browser and the containers are both running on the same system you can use localhost
; if Docker is running in a VM (perhaps on the older Docker Toolbox setup) you need the VM's IP address.
QUESTION
I am using Postman to simulate deleting some data from my JSON
database when I send a DELETE
request via http://localhost:3001/delete/1
in my backend/lib/routes.js
ANSWER
Answered 2020-Nov-22 at 06:48Your getting the wrong response because your comparing a string to a number. When "finding" the index it's return is -1
because you are using the equivalence operator ===
. You just need to type cast the string to a number when grabbing the param.
QUESTION
I am following part 4 of this tutorial
My package.json
has the following scripts to run mocha tests and run the node server
ANSWER
Answered 2020-Nov-21 at 09:56Looking into your Github in backend/lib/json
the files are:
QUESTION
I am following step 1 of this tutorial
I have the following folder structure:
...ANSWER
Answered 2020-Nov-20 at 09:40Found two issues
- Your package.json file is misplaced. Place it with ".gitignore" file. And run "npm install"
- "chai" is required. Do "npm install chai"
QUESTION
I am following step 1 of this tutorial and created two new folders called lib
and test
inside my backend
folder. My folder structure looks like the following:
ANSWER
Answered 2020-Nov-20 at 09:05I did git add --all
, committed, and pushed which solved the issue.
QUESTION
I finished step 1 in this tutorial on how to set up a MERN stack project.
I have a .gitignore
with the following contents
ANSWER
Answered 2020-Nov-17 at 07:47If your repository is in the backend folder, meaning you have
QUESTION
On my Pi I followed this tutorial to install docker on raspbian. Few side notes here:
- I did NOT setup a swarm, I stopped at docker info and (as in other guides) I succesfully ran the hello world container.
- idk if it matters, but this guide (unlike others) had me edit
/etc/apt/sources.list
and add line:deb https://download.docker.com/linux/raspbian/ stretch stable
On my develop machine (win 10) I used this tutorial to add docker configs and ymls to my mern stack app. However at multiple points in this tutorial they wanted me to run docker commands, so I ended up having to install Docker Desktop.
But I don't want to use local containers, I want to use the remote one on my Pi. So I used this tutorial to try and setup my remote docker.
However Im getting an error:
C:\Users\oweng>docker-machine create --driver generic --generic-ip-address=192.168.1.2 --generic-ssh-key "%HOMEPATH%/.ssh/id_rsa" --generic-ssh-user=pi remote-docker-host Running pre-create checks... Creating machine... (remote-docker-host) Importing SSH key... Waiting for machine to be running, this may take a few minutes... Detecting operating system of created instance... Waiting for SSH to be available... Enter passphrase for key 'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa': Enter passphrase for key 'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa': Detecting the provisioner... Enter passphrase for key 'C:\Users\oweng.docker\machine\machines\remote-docker-host\id_rsa': Error creating machine: Error detecting OS: OS type not recognized
I have googled the error a bit but havnt found a solution.
furthermore when checking listening ports on my Pi (docker server) I dont see it running
pi@raspberrypi:~ $ sudo lsof -i -P -n | grep LISTEN xrdp-sesm 390 root 7u IPv6 14566 0t0 TCP [::1]:3350 (LISTEN) sshd
404 root 3u IPv4 17224 0t0 TCP *:22 (LISTEN) sshd
404 root 4u IPv6 17226 0t0 TCP *:22 (LISTEN) xrdp
406 xrdp 11u IPv6 17302 0t0 TCP *:3389 (LISTEN)
So I feel like maybe the server is not running? But it seems to be.
pi@raspberrypi:~ $ systemctl status docker ● docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2020-11-03 07:18:21 PST; 3h 35min ago Docs: https://docs.docker.com Main PID: 496 (dockerd) Tasks: 13 CGroup: /system.slice/docker.service └─496 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.064113743-08:00" level=warning msg="Your kernel does not support cgroup blkio throttle.w Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.064249212-08:00" level=warning msg="Your kernel does not support cgroup blkio throttle.r Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.064373483-08:00" level=warning msg="Your kernel does not support cgroup blkio throttle.w Nov 03 07:18:14 raspberrypi dockerd[496]: time="2020-11-03T07:18:14.066367493-08:00" level=info msg="Loading containers: start." Nov 03 07:18:17 raspberrypi dockerd[496]: time="2020-11-03T07:18:17.612685200-08:00" level=info msg="Default bridge (docker0) is assigned with an IP address Nov 03 07:18:18 raspberrypi dockerd[496]: time="2020-11-03T07:18:18.710629367-08:00" level=info msg="Loading containers: done." Nov 03 07:18:20 raspberrypi dockerd[496]: time="2020-11-03T07:18:20.815943637-08:00" level=info msg="Docker daemon" commit=4484c46 graphdriver(s)=overlay2 v Nov 03 07:18:20 raspberrypi dockerd[496]: time="2020-11-03T07:18:20.822947178-08:00" level=info msg="Daemon has completed initialization" Nov 03 07:18:21 raspberrypi systemd1: Started Docker Application Container Engine. Nov 03 07:18:21 raspberrypi dockerd[496]: time="2020-11-03T07:18:21.273201136-08:00" level=info msg="API listen on /var/run/docker.sock"
Update 1
following this SO post i was able to get the server running it seems. Editing docker.service file. I now get a different error when trying to create
C:\Users\oweng>docker-machine create --driver generic --generic-ip-address=192.168.1.2:2137 --generic-ssh-key "%HOMEPATH%/.ssh/id_rsa" --generic-ssh-user=pi remote-docker-host Running pre-create checks... Creating machine... (remote-docker-host) Importing SSH key... Waiting for machine to be running, this may take a few minutes... Error creating machine: Error waiting for machine to be running: Maximum number of retries (60) exceeded
Update 2 BMitch's comment lead me to these two tutorial which seem to be exactly what im trying todo https://code.visualstudio.com/docs/containers/ssh https://code.visualstudio.com/docs/containers/choosing-dev-environment#_remote-machine
...ANSWER
Answered 2020-Nov-04 at 22:21I wouldn't use docker-machine
for that. Support for the tool seems to be going away, and there are much easier methods.
The easiest is to set DOCKER_HOST
on your machine to be the ssh setting of the remote node:
QUESTION
I have a MERN application that I'm trying to host on Heroku. Right now the application is deployed to a Raspberry Pi, and everything works fine there, but as soon as it gets to Heroku all of my API GET requests result in 404 errors. I can get the React front end, but nothing else works. The Mongo portion is hosted on the sandbox tier of Atlas and is whitelisted to accept any authorized connections.
Things that I've tried:
- Not routing /api calls to static React files via server.js
- Updating all references to port numbers to use
process.env.PORT || 3001
- Swapping my proxy in my React client package.json from
localhost
to127.0.0.1
- Reconfiguring my axios calls to the API with the following config:
ANSWER
Answered 2019-Mar-17 at 18:12Ok, I think I figured out what was going on here. This appears to be related to how the baseURL is set up in Axios.
During local development I made the mistake of assigning an IP variable and then making any API calls like so: ${ip}/api/whatever/whatever
I thought I was on the right track with the Axios config I posted above, but what I actually needed to do was set up Axios like this:
QUESTION
I'm working in a mern stack app and when I try to pass the state to specific component's props I get errors.
I get the error:
...ANSWER
Answered 2019-Jan-18 at 00:35You're mismatching the connected component imports and exports.
In ShoppingList.js
, you have:
QUESTION
I am setting up a React project using webpack and babel, but I am getting the error that React and ReactDOM can't be resolved.
Is the problem is with the version of Webpack or Babel?
...ANSWER
Answered 2018-Apr-21 at 15:28This code looks fine to me. I think you have missed the dependency installation step before running webpack command.
Please try and follow the below steps in order and see if it resolves the error.
- Run
npm install
inside the directory this will make sure all the dependencies you have mentioned in package.json are downloaded to node_modules directory. - Then run
npm run webpack
to generate the bundle.js
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mern-app
Clone the repository
Change directories to the frontend directory and install dependencies do the same for the api folder
Change the connection URL in the index.js file inside of api/src
Make sure you're inside of the frontend directory and run yarn start, this will start the react app which will then be available at http://localhost:3000
Go inside of the api directory and run node src/index, this will start the API
You may now navigate to the react app and enjoy!
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page