r/learnjavascript • • May 30 '20

I Turned A Raspberry Pi Into A Node.js Web Server

https://www.youtube.com/watch?v=iSAF8D8rp0o
217 Upvotes

25 comments sorted by

14

u/loueed May 30 '20

Great video man. I wonder if you could configure your rooter to access this from the internet. You could then stick cloudflare in front of it to handle traffic. Could be a cheap solution to host a static site 👍

10

u/portexe May 30 '20

Yep, that's actually the next step for me! I know a fair amount of web security, but I need to do a bit more research before I feel comfortable enough exposing it outside my local network though.

14

u/lantosgyuri May 30 '20

Pls make a video if you do this. And notify me.

2

u/lokriet May 30 '20

I literally just learned about their existence yesterday, and now there's articles about them everywhere. Talk about Baader Meinhof phenomenon xD

9

u/portexe May 30 '20

And now that I know that effect is called the Baader-Meinhof Phenomenon, I’m going to be hearing that word a lot now.

1

u/lokriet May 30 '20

He he he >)

1

u/mitwilsch May 30 '20

Who is this Baader-Meinhof? Been hearing a lot about him today.

8

u/[deleted] May 30 '20

very cool!

1

u/Jnsjknn May 30 '20

What a coincidence. I just did the same thing this week. If you (OP) or anyone else want to chat about ideas or problems with RPi + Nodejs, feel free to hit me up.

1

u/portexe May 30 '20

What sort of problems did you run into?

1

u/Jnsjknn May 30 '20

Not much problems so far, although I've only really used it to test that it works.

Only time I got stuck was when I was trying to make the server accessible from outside my local network. I somehow couldn't figure out how to do the port forwarding but it ended up being extremely simple.

1

u/Oma_X12 May 31 '20

Can you host your website on your own machine (raspberry pi) ?

1

u/portexe May 31 '20

You can indeed.

1

u/Oma_X12 Jun 01 '20

It's impossible on arduino yeah?

3

u/pmacking May 30 '20

What exactly would this pi setup provide you that you couldn’t do from your computer? ... new to this domain myself

8

u/mitwilsch May 30 '20

Servers run all the time. You can Host a webserver from your computer, until you turn it off.

You can buy another equally powerful computer and leave that on all day and night. Then cry over your electric bill.

You can also host with a cloud service, or server provider. Who have access limits, and cost money.

Pi is the cheap, low-power, DIY server that you control. Until your app gets really big or popular, then you can buy the fancy servers.

2

u/pmacking May 31 '20

Got it, thanks.

2

u/ron_jj May 30 '20

would like to know this aswell

1

u/2dP_rdg May 30 '20

technically, nothing. The idea of "I turned a Raspberry Pi into a Node.js Web Server" is right up there with "I turned [any computer] into a Node.js server"... it's not really much of an accomplishment.. But the reason to do a Pi instead of your computer would be that the Pi (assuming it meets web traffic demands or sits behind a CDN to alleviate stress) consumes far less power and could be left on 24/7 with minimal impact to your electricity bill. Could even go as far as to power it with a solar panel/battery setup.

2

u/Beermedear May 30 '20

This was really useful - I be been wanting to do something similar - time to get cracking!

2

u/WTF3rr0r May 30 '20

Cool I never notice remote ssh on vscode

1

u/reforitor May 31 '20

Hey, great content dude! But could you please change the mic placement? It's kinda distracting :")

0

u/[deleted] May 30 '20

[deleted]

17

u/portexe May 30 '20

Maybe not, but it was very fun and I loved documenting the process. I have a feeling that there are a lot of developers who have heard of Raspberry Pi, but have not really seen much about it that seems relatable. I'm hoping this will kind of be a more relatable DIY project video for us webdev's.

15

u/Beermedear May 30 '20

Check the sub you’re in. No reason to bring that type of attitude - it’s a video aimed at helping others with no ads, no asks for patreon, etc. Just a dude sharing a concise, helpful guide.

0

u/sgthoppy May 31 '20

Doesn't have anything to do with learning javascript, though. He already knows javascript, or at least enough to know what node is and its toolset (nvm and npm). He hosts an open-source file storage site without touching any javascript himself, except for those 5 frames where code is shown at 5:45, and it looks like it's just pasted from a tutorial, as it spontaneously appears in a previously empty file.

Not to mention the bad practice setting permissions on /srv to 777.