Netlify and Heroku deployment for Socket IO snake game

  Рет қаралды 12,693

Hungry Turtle Code

Hungry Turtle Code

Күн бұрын

Пікірлер: 87
@TraversyMedia
@TraversyMedia 4 жыл бұрын
Nice 😊
@slavaefremov473
@slavaefremov473 3 жыл бұрын
Man, thank you so much for this video and for the websockets and snake tutorial. Thanks to you i was able to build a multiplayer blackjack app with websockets and deploy it on heroku. On the latter part i've spent a couple of days till i figured out that my server was building fine, heroku just didn't serve it from the right folder. It is really great how you give not only instructions but more of a developer mindset when you explain things, like in the snake game you talked about thinking ahead when you build the game state. Thank you for your work.
@cheese3038
@cheese3038 3 жыл бұрын
Thank you so much for this video! Everything is expertly explained. Literally would pay good money for content like this!
@andyhue5457
@andyhue5457 2 жыл бұрын
Who knew I’d learn so much from mr.beans
@kobebriansantos5558
@kobebriansantos5558 2 жыл бұрын
Thank you fricking so much, been trying to deploy my MERN app for the whole day now!!!!! You're a life saver
@robotosailr2129
@robotosailr2129 3 жыл бұрын
This was what I needed. I have been looking for a tutorial that fully explains how to do this.
@EchoVids2u
@EchoVids2u 2 жыл бұрын
Best deployment tutorial regarding this topic I've seen yet. Very clear explanation. thank you!
@the_full_stack_junkie
@the_full_stack_junkie 4 жыл бұрын
Great content man hope your channel booms after the Traversy Media upload💪🤓
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
One can only hope :) A great experience either way.
@anujshrestha8670
@anujshrestha8670 3 жыл бұрын
Seriously learned about canvas and socket.io in a single lesson. Thanks a lot for the meaningful video
@Hungryturtledev
@Hungryturtledev 3 жыл бұрын
You are welcome 🙂
@chriscoyc
@chriscoyc 2 жыл бұрын
what a amazing tutorial! Some time ago i was searching for a way to deploy from a sub dir and i didn't found a easy way, and you showed a really simple way, thanks for the content!
@dominikd9834
@dominikd9834 4 жыл бұрын
I was looking for this tutorial for ages. Thank you. Subbed, liked.
@stevenaschoff
@stevenaschoff 3 жыл бұрын
Outstanding video! Very clear and all information was pertinent! Solved my issue with heroku magic with port injection ... wasn't showing up anywhere with my google fu but you clearly explained it and everything just started working for me. Thanks for publishing!
@hamsterking9364
@hamsterking9364 2 жыл бұрын
I learned so much with your tutorials, and finally I was able to finish my game, tks so much I appreciate
@kaaneii
@kaaneii Жыл бұрын
That was a mission, but I finally got it , thanks g, top man
@aleb687
@aleb687 4 жыл бұрын
from traversy too. Did not know you man, and you are really good! I liked those interactive explanatory visuals you put in the back while you explain something, and also this deployment video. I have been coding for about a year and learned everything on my own, but it is nice to have someone explain stuff the way you do. The buildpack for example I did not know.. in fact I am still wondering how I managed to deploy a few backendish apps in the past !!
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
Welcome aboard!
@Andreas-hy7ob
@Andreas-hy7ob 3 жыл бұрын
To anybody that gets a error on deployment: Make sure you add the flowing to your package.json "scripts": { "start": "node app.js" }, Ofc edit the node app part to the correct file name. Dident notice it in the video, and have been fighting this easy solve for quite awhile, so i thought id let future people know!
@T12321
@T12321 3 жыл бұрын
This video has earned you a sub. Thanks!
@undermaker4535
@undermaker4535 2 жыл бұрын
Great tutorial! Just one question: why doesn't the red snake move on it's own when the game starts? I've tried to set vel of x to 1 of the red snake.
@theemacsen1518
@theemacsen1518 4 жыл бұрын
Nice to see that you are back dude! Really missed you LOL
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
I'm glad to be back. Hopefully this time I will stick around for longer. Any videos you would like to see?
@theemacsen1518
@theemacsen1518 4 жыл бұрын
@@Hungryturtledev Hmm.... maybe some Mern projects?
@elnazalimardani
@elnazalimardani 3 жыл бұрын
You ARE the best! haha! Thank you for the calm explanations!
@NewDay-gt7
@NewDay-gt7 4 жыл бұрын
Thank you so much for this video, it was informative and interesting, I love your personality
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
Thank you!
@57Javier747
@57Javier747 3 жыл бұрын
It works like a charm! Thanks for sharing Adrian
@Hungryturtledev
@Hungryturtledev 3 жыл бұрын
You're welcome!
@bronstein007
@bronstein007 Жыл бұрын
This is great! Two questions: 1. What is the reasoning behind not hosting everything on heroku? 2. If someone decides to host everything on heroku, is the buildpack and PROJECT_PATH env var necessary? Thanks so much! I've been wondering about how deployment w/ web sockets works.
@sohamtalele
@sohamtalele 3 жыл бұрын
exactly what I was looking for!
@ishanvarshney9054
@ishanvarshney9054 4 жыл бұрын
your content is awesome buddy!
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
I'm very glad you like it! I will be producing a lot more content! I'm excited
@andreas63383
@andreas63383 4 жыл бұрын
great tutorial! as a beginner to javascript, this snake game really helped me learn sock.io and online JavaScript. question tho, and it may seem stupid but how would i add in images for the snake, food and background instead of having them as coloured squares?
@claralautre4238
@claralautre4238 2 жыл бұрын
Thank you this saved me !! 👌
@swoorp
@swoorp 4 жыл бұрын
No dislikes yet!! Love the info you provided in this video
@MaxwellMcKinnon
@MaxwellMcKinnon 3 жыл бұрын
I'm experiencing latency when I play the game with a friend. Is there anything inherent to the game code that would be causing the latency? We seem to be able to play other AAA multiplayer titles for example, so I don't think it's our computers or internet connections. Awesome tutorial, thanks a lot
@shashankagarwal9301
@shashankagarwal9301 2 жыл бұрын
Heya, I've been experiencing latency too, were you able to fix yours?
@Amandeepsinghjaura10
@Amandeepsinghjaura10 4 жыл бұрын
Great video, but can't we upload both frontend and backend on heroku ?
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
We definitely can. I just prefer netlify for frontend. That plus using both exposes people to more options. But if you want to put it all on heroku 100% do it, it's a great solution
@katiepatton8932
@katiepatton8932 3 жыл бұрын
Yeah I also wanted to double check that I could deploy it all on heroku. I'm picturing a project like this: repl.it/@templates/Socketio-Chat-Template#index.js where you use express from the server to expose the static content. Would this work with a heroku deployment?
@Slokingseba
@Slokingseba 2 жыл бұрын
I have a problem "heroku features:enable http-session-affinity" requires another arguemnt, either -a and I have to specify a app or -r and a i have to specify a remote distination, what should i put here?
@Slokingseba
@Slokingseba 2 жыл бұрын
Aha, you have to connect to your github repository and write this commands in git bash! If someone is confused how to do that, follow this kzbin.info/www/bejne/iHiym2ivfZyYrM0
@FlavioZanoni
@FlavioZanoni 3 жыл бұрын
Very helpfull, thanks !!!
@rsk2002
@rsk2002 2 жыл бұрын
Thank you ❤❤
@herbertk9266
@herbertk9266 3 жыл бұрын
Thank you
@yadday5153
@yadday5153 Жыл бұрын
How did you handle CORS? Did you need to?
@arcticnerd5994
@arcticnerd5994 3 жыл бұрын
Whats the advantage of using both Netlify and Heroku? I've just been deploying on heroku.
@310-q1c
@310-q1c 3 жыл бұрын
I get the PROJECT_PATH is undefined error when trying to deply. HELP
@ronaldc8634
@ronaldc8634 3 жыл бұрын
Is it possible to do it cleanly with a shared directory?
@Ranyyz
@Ranyyz 3 жыл бұрын
No matter what I do CORS errors are always happening. How do I update it to make it work?
@abdelkaderbennaoum3882
@abdelkaderbennaoum3882 3 жыл бұрын
On server.js, do const io = socket(server, { cors: { origin: "*" }, });
@Ranyyz
@Ranyyz 3 жыл бұрын
@@abdelkaderbennaoum3882 Didnt work :(
@MaxwellMcKinnon
@MaxwellMcKinnon 3 жыл бұрын
What's the advantage of splitting the deployment between Heroku and Netlify, rather than just using one or the other?
@HardcorePanda
@HardcorePanda 3 жыл бұрын
netlify doesnt support backend deployment like running a nodes server etc. i would use heroku for both frontend and backend deployment instead of seperating.
@max_mlr
@max_mlr 3 жыл бұрын
Hello, It’s not working for me I get a 404 error
@abinjacob36
@abinjacob36 3 жыл бұрын
Bro I get 429 status error code ,how can I fix it
@muadlala
@muadlala 3 жыл бұрын
I really liked the video, I used socket.io V3, and now I get a CORS error, so... Please help ??
@venomo12
@venomo12 2 жыл бұрын
I have the same issue, Have You found he solution?
@undermaker4535
@undermaker4535 2 жыл бұрын
I'm no longer getting a game code Can someone please help me please, I tried a lot of stuff and I'm getting desperate. Here's what happened: After successfuly running the game via npx-live server (old video method) several times, it's not working anymore and I can't figure out why. It will load the html page but it will not display the room key anymore. It just says "Your game code is:" and then it's just blank. I tried get a new copy of the source code which worked few times then again I'm getting the same error. And now even if I get a fresh copy I will instantly get the error where it shows no game code
@lohithnh3496
@lohithnh3496 Жыл бұрын
Even I'm getting same thing, please tell me if you find the solution
@TomTheCat
@TomTheCat 3 жыл бұрын
I keep getting CORS error, even though I did everything exactly as it was shown in the video(s) - so I have socket.io version 2.x. This error drives me crazy, since I’ve been trying to solve it for days now, but still cannot figure out the solution by myself. What sould I do, can anybody help me, please? 😩
@zonfr
@zonfr 3 жыл бұрын
Have you tried to add this code in your server.js ? : const io = require("socket.io")({ cors: { origin: "*", } });
@TomTheCat
@TomTheCat 3 жыл бұрын
@@zonfr Thanks for your reply. I modified the code as you suggested above, then installed the newest cors (v2.8.5), but unfortunately, this did not solve the problem either.
@rask1978
@rask1978 3 жыл бұрын
@@zonfr I LOVE U OMGL.MEZE
@richardalex1130
@richardalex1130 3 жыл бұрын
@@TomTheCat same problem, cors error
@Purpleshirts
@Purpleshirts 3 жыл бұрын
I got this working by setting the cors origin to true. i.e. cors: { origin: true, methods: ["GET", "POST"], credentials: true }
@ianmubangizi6721
@ianmubangizi6721 4 жыл бұрын
Hey Adrian can you please show us your dev setup - terminal, os, and vim config?? if possible
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
I definitely want to do a video to clear it all up because I do get a lot of questions about it. Super quick rundown though - I use Arch linux, xfce terminal and I usually use tmux but I tend to avoid that in videos because it could get confusing. My vimrc and other dotfiles can be found here: github.com/adiman9/dotfiles
@CameronAudet
@CameronAudet 4 жыл бұрын
@@Hungryturtledev Your skills in VIM are out of this world. I would love a video on not only how you have it set up but how you are using it so fluently!. Thanks for the great video. (Show keystrokes in the video? :shrug: :)
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
@@CameronAudet I would love to do a series on how I use vim. It's taken me a long time to get to where I am and there are a lot of things I wish I knew when I started. There does seem to be a lot of interest so maybe I'll do it sooner rather than later
@CameronAudet
@CameronAudet 4 жыл бұрын
@@Hungryturtledev I can't wait, your Vim skills are majestic.
@BrainWavesVillain
@BrainWavesVillain 4 жыл бұрын
I don't understand. Why not host backend and frontend on the same platform?
@Hungryturtledev
@Hungryturtledev 4 жыл бұрын
Netlify doesn't support stateful backends as far as i'm aware (it's just functions) which is required for this project and static hosting on Heroku isn't as nice. With that said I figured it was also a good opportunity to introduce different platforms to an audience who want to learn.
@MaxwellMcKinnon
@MaxwellMcKinnon 3 жыл бұрын
@@Hungryturtledev Ah thanks for the explanation!
@fhilipknows6000
@fhilipknows6000 4 жыл бұрын
im getting this error when i try 5:05 » Error: Missing required flag: » -a, --app APP app to run command against » See more help with --help
@Andreas-hy7ob
@Andreas-hy7ob 3 жыл бұрын
Same, have you found a solution yet?
@57Javier747
@57Javier747 3 жыл бұрын
Type in the folder you create the app heroku apps It will show all heroku apps you got. then you applied changes on app you want. heroku features:enable http-session-affinity -a quiet-sea-74691 which quiet-sea74691 is my app i want to change the feature
@Andreas-hy7ob
@Andreas-hy7ob 3 жыл бұрын
I had multiple issues, so i messed alot around. Dont rember how exactly i solved that issue, but i did solve another by adding the flowing to your package.json "scripts": { "start": "node app.js" },
@57Javier747
@57Javier747 3 жыл бұрын
​@@Andreas-hy7ob the only problem i had it was this heroku cli missing flag, and now its working , I'm in Ubuntu 20.04. Which OS are you working?
@ferrugemjavascript9269
@ferrugemjavascript9269 3 жыл бұрын
To anybody that wants a more simple version to deploy I made this fork with express github.com/alexsad/multiplayer-snake
@eugeniogonzato
@eugeniogonzato 3 жыл бұрын
Dear @ Hungry Turtle Code I like so much your video and I your way. I like to share my experience with your tutorial, first time I try in my local server I ran in to a 'cors' problem, so looking for around in the web I find this solution that works for me ``` const server = require('http').createServer() const cors = require('cors') const io = require('socket.io')(server, { cors: { origin: 'localhost:8080', methods: ['GET', 'POST'] } }) io.on('connection', client => { console.log('connesso') client.emit('init', { data: 'hello world' }) }) server.listen(3000) ``` I share with you only for information. Thanks
@hansomekim1219
@hansomekim1219 3 жыл бұрын
It didn't work exactly as described in this video. Mine gave me the below heroku build log error on deployment. I fixed it by deleting my yarn.lock file, and committing those changes and redeploying from there. Just trying to help out anyone else who might run across the same issue! -----> Building on the Heroku-20 stack -----> Subdir buildpack app detected -----> Subdir buildpack in server creating cache: /tmp/codon/tmp/cache created tmp dir: /tmp/codon/tmp/cache/subdir0v6KJ moving working dir: server to /tmp/codon/tmp/cache/subdir0v6KJ cleaning build dir /tmp/build_3abdf7cb_ recreating /tmp/build_3abdf7cb_ copying preserved work dir from cache /tmp/codon/tmp/cache/subdir0v6KJ to build dir /tmp/build_3abdf7cb_ cleaning tmp dir /tmp/codon/tmp/cache/subdir0v6KJ -----> Node.js app detected -----> Build failed ! Two different lockfiles found: package-lock.json and yarn.lock Both npm and yarn have created lockfiles for this application, but only one can be used to install dependencies. Installing dependencies using the wrong package manager can result in missing packages or subtle bugs in production. - To use npm to install your application's dependencies please delete the yarn.lock file. $ git rm yarn.lock - To use yarn to install your application's dependences please delete the package-lock.json file. $ git rm package-lock.json help.heroku.com/0KU2EM53 ! Push rejected, failed to compile Node.js app. ! Push failed
@calcio437
@calcio437 2 жыл бұрын
I use vercel, the easiest way in the world!
@calcio437
@calcio437 2 жыл бұрын
but netlify is super interesting if you have a organisation! is free when vercel isn't for organisations
WebSockets in 100 Seconds & Beyond with Socket.io
8:31
Fireship
Рет қаралды 1 МЛН
Socket IO Rooms Tutorial (Backend part 1)
17:35
Coding With Chaim
Рет қаралды 43 М.
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 4,1 МЛН
НАШЛА ДЕНЬГИ🙀@VERONIKAborsch
00:38
МишАня
Рет қаралды 2,6 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 262 #shorts
00:20
Learn Socket.io In 30 Minutes
27:27
Web Dev Simplified
Рет қаралды 506 М.
How To Learn React JS Fast
14:50
Hungry Turtle Code
Рет қаралды 80 М.
Netlify Serverless Functions with Netlify Dev
12:17
James Q Quick
Рет қаралды 29 М.
Young People Try Windows XP
14:19
Linus Tech Tips
Рет қаралды 1,4 МЛН
How to create a serveless express app in netlify
11:47
AsyncFile by Bibek
Рет қаралды 22 М.
Best way to learn Socket IO | complex chat app
19:52
Hitesh Choudhary
Рет қаралды 110 М.
Ryan Dahl introduces JSR at DevWorld 2024
29:13
Deno
Рет қаралды 112 М.
Coding a Snake Game in 5 mins with Javascript - Speed Coding
6:22
Hungry Turtle Code
Рет қаралды 30 М.
4.3 Hosting a WebSocket Server on Glitch - Fun with WebSockets!
10:50
ParametricCamp
Рет қаралды 16 М.