I Turned A Raspberry Pi Into A Node.js Web Server
Vložit
- čas přidán 7. 06. 2024
- I decided to grab a few raspberry pi's recently and have been wondering what projects I should do with these. This is the first of many projects I've decided to do. I ended up turning this first one into a Node.js web server. It also doubles as a file server for transfer files between devices on my network. This video shows the entire process of how I went about doing this.
#RaspberryPi #Node.js #WebDev
⭐️ Interested in the kit I got? Below are affiliate links for the exact supplies I used:
Raspberry Pi CanaKit: amzn.to/36Qpfgf
3M Adhesives: amzn.to/36IWHFq
👀 Follow Me:
Twitter ➔ / portexe
Instagram ➔ / port.exe
GitHub ➔ github.com/portexe
Facebook ➔ / portexe
Website ➔ www.portexe.com/
GAMING ➔ / portexe
---
🎵 Music by Alexander Aultman. Show him some love!
music.alexanderaultman.com - Zábava
when dragging the files over to your pi os sd card you can simply add a ssh file thats empty and that will enable ssh on the pi. That will allow you to skip the whole hooking it up to your TV part.
Very good point brother
This is what I did, much easier.
This was really interesting!
Web Dev Simplified oh hey. It’s you!
So, I got it, what you were doin when not uploading the videos ♥️
Yeah!
a tip: watch movies at Flixzone. Me and my gf have been using it for watching loads of movies during the lockdown.
@Kyler Malachi yup, been watching on Flixzone for years myself :)
Amazing! Just what I was looking for! Thank you so much
This is awesome man thanks.
Nice little video and good overview, thanks.
Amazing mate, this is what I was looking for :)
great work man. keep it up..!
Thank you, very straightforward
Nice video. The raspberry pi is so powerful
Seriously man, this video was so dope🔥
Oh good stuff, actually what I was looking for. I'm planning to build something with a raspi 4, rgb strips and Flutter. Thank you! P.S: That file system is really cool as well... now you got me wondering if I should give this a shot in tandem with the rgb thing
Wow, what a high quality video! Nice work ensuring that the video and audio quality are top notch! It's exciting seeing what people are doing with the latest Raspberry Pi!
Would you happen to know of any benchmarks for how Raspberry Pi 4B performs with number of requests on a
Node server?
Probably depends on a bunch of factors such as the complexity of your server, your internet connection, if you use an SD card or an SSD for possible data storage, if you overclock your Pi and if you use the lite or desktop version of the OS. I am interested myself. I just started getting into web development so I'll probably test this in the future and maybe remember to reply :)
Well... I ended up spending the whole evening figuring this out.
My conclusion is: for a simple "hello world" page it can handle up to about 600 requests a second.
I have no idea what is a proper way to test this, I just tried sending a get request every couple miliseconds in a loop. Above 600 requests a second the response time often got long and it could even stop working.
I used Express.js, the desktop version of the OS and did not overclock (regular 1.5 GHz RPi 4B)
Bro i was having issues updating Node... THANKS FOR THIS LOL
Thanks
Oh my god thanks for showing the Remote SSH Plugin this is going to be so useful since I used to code on pi itself using nano ^^'
dude you are hardcore :D
@@unsound-methods yeah it's way better to code on vs code
micro is a terminal editor and has the common commands (ex: control+S for save) just like most editors. It should be able to completely replace nano, I think. I beleive you can also use it split screen (one half of the window for your PC and the other half for Pi - at same time). I am new to it.
@@genkiferal7178 thanks for the fact
press `ctrl+J` to open console tab and do the JS check there, great video
great video. i looked up the droppy file server and the person whom made it is not working on it anymore with the last time being 2020. do you know of a good replacement that is still supported and is as simple and good like droppy?
Omg I was just looking at rpi proj but found out exactly what I want, which is a way to transfer media from my phone and store it in a file server which I can browse.
Which terminal are you using? I can see multiple terminals option...
Cool video. Can you please let us know something about the installed nodejs web server's performance? I am planning to buy one pi to setup such server but I'm very confused thinking its performance, reliability's comparing to the paid hosting services. Also, webserver should running 24x7, so can this little boy do this for 24x7 continuously?
If you’re needing a production server where there will be users who need reliable speed and uptime, I would say don’t use the Pi, UNLESS you know what you’re doing.
Missed the full tutorial and some explanations for noobs like me...
I am not able to install node js in my rpi using the same commands as you did. Can you help me with the updated command for installing nvm?
Silly question would you gain anything from implementing Kubernetes onto your RaspberryPi ? I'm trying to figure out what project to do and don't really understand what Kubernetes is for/ what is useful about it
I suggest looking into docker, kubernetes is more for docker management
Do you have a static up to access it publicly or is it just for local use
It’s only for local use right now
If i turn of the raspberry and then turn on the. This will launch the server automatically?
Nice video! How did you get your windows cmd to not suck and actually look appealing?
I am using the new Windows Terminal. It's not installed by default, but you can get it from the Microsoft Store. Takes a little bit of customization to get it to look good, but it's pretty straightforward.
@@PortEXE Thank you :)
So here I am having no idea what this genius is doing
same
He just created a personal server where he stores data about his webpage(s) which users can access by requesting. For example - suppose his website xyz.com is a music downloading page. He stores all the actual music files in his raspberry Pi server and keep it switched on all the time for the server to function. You visit xyz.com and request to download a music file , your browser requests his raspberry Pi to let you download the requested file.
Is this the same project as using a web interface for your Raspberry Pi?
How to make it host a live server and display it on a screen from a pi. Just as iF I would use GitHub pages and use the pi to access the page and display it on a screen how would I host it and access display it on a screen from the pi. I don't need anything else to access the site. The site will have html files, Js files and css files
How do I host a website tho? and giving it a domain name?
Is it possible for you to change the web address?
It's such a strange thing for me to get hung up on, but you really should have trimmed the other end of that command strip. The tab you snipped was for removal :)
best way to serve this?
Square pin is indeed pin 1...industry standard....
Which cmd r u using
Advantages of own server???
This is cool! What would you use a web server for?
backend for a website, API etc
your own VPN, your own cloud service such as NextCloud, your own media (I want mine for music), your own web site....
You do realize the tabs you cut off are what is used to remove the sticky part later right?
Yes, that was intentional.
thanks bro i do not know what I am doing but it worked thanks.
Can I acess it over internet?
how fast are the responses?
why not use Noobs Lite and Raspbian Lite when ur going 2 use SSH to control ur pi?
I actually plan to use it for all sorts of purposes
i've some question about Droppy account how can i create Droppy account?
Are you required to leave the raspberry pi on all the time or can you turn of the power when your not using it?
You can turn off the power when you're not using. It's suggested to set up your Node server and/or file server to boot automatically with the OS so that it's truly "Plug and play".
@@PortEXE what do you mean boot automatically?
You can write a bash script that will boot the server up automatically when the device powers on. If you ever need help with that, feel free to reach out to me when the time comes.
@@PortEXE will do thank you
@@PortEXE you should make more useful video like this!!
That's a great showcase of the RPi 4 features, except for the limited storage on the SD card. Which hints sticking some extrenal USB 3.0 hard drive next to it.
Yeah without an external drive it wouldn't be recommended to use as a file storage server, but it would work fine for a web server for serving web sites.
idk why u install raspberry pi desktop when u r just going to use ssh.
It's great tutorial but, how to add the domain name
You have a huge command center but don't know how to setup a raspberry pi without monitor and keyboard attached?
One can do all the config with config-files on your sd-card.
But this will only work on your local network
Its no way connected to the outside of the world right?
When you would be in your home network you can use this as a web server
But it doesnt solve any purpose if the "web" server is not open to the internet
You’d just need to do some configuration to open it to outer networks. I plan to mainly use this web server for development on my local network.
You will need to open a port (usually 80) on the router to make it a web server. Be careful though, you need to secure the pi first. Here is a good starter www.raspberrypi.org/documentation/configuration/security.md
You might want a dynamic dns service too, if you don't have a static public ip address. There are free and paid ones. Modern router admin usually had settings to configure them, but if not, you can use something like ddclient.
If you just need to temporarily share a site you're working on with someone and don't want to change your router config, you could also use ngrok or localtunnel. If you're using their free tier, the URL would just change every time you start it up.
Me looking down at my megaminx... Me looking around at my monitors and LED lit desktop setup... Me looking at my systems domain name, while you refer to your setup as 'the Lair'... WHO ARE YOU AND WHY ARE YOU IN MY HEAD?!?!?!
Why no hard line? No RJ45? No Ethernet cable?
heard of WiFi?
that is also my concern, but maybe since he only uses the Pi at home, he doesn't need that? I am looking for a new room to rent and am worried about the whole Ethernet cable issue since I hope to learn to use the pi server outside of the home and maybe even put a small website up.
3:00 why did he do whatever he did there?
It’s to check and make sure that the file hasn’t been modified by a nefarious 3rd party. Hackers can be clever, so checking the hashes is always a good thing to do.
@@PortEXE ok cool. Ty for answering 👍
Would that just be like a Google drive
It will have more functions than GDrive. Forwarding the port will make it accessible from anywhere in the world.
Can we put this website online?
Yes although it would require further configuration.
How to host my own domain on this server?
In case you have a static ip address, you should use your modem DMZ option, add MX zones to your raspberry pi and also your own DNS, using cloudflare will make it easier for you to do so.
DDNS would be another option which is not 100% errorless.
How to host my own domain on this server?
@@CharleyCheno just replied the same question in the above reply, 2 months ago :)
How to host my own domain on this server?
@@Someone-ju7sx lol
But muh "Oh noes, they will do hax if you open port 80!!!"
😂
Not really a tutorial unfortunately.
Could you make a quick step by step tutorial, please?
This was just a fun little project I did. I have no plans on making a tutorial for this project. Perhaps in the future I may do something similar however.
How much file can the server hold? As much as the SD card?
Yes as long as that’s how you’re Linux file system is set up. Which it should be by default.
There was a mod for the pi 3 where you flash an update to it to boot from USB (& Ethernet). I did that and I got it running from a flashdrive .
@@kingofthepod5169 ? you mean your booted into a live USB OS like you can on a PC? I am new and learning. DOn't want to make costly mistakes and buy the wrong thing(s).
No entendí
Awesome content, but that intro beat is whack
Where was the Node.js server tutorial? You spent 5 minutes setting up the Raspberry Pi and about 30 seconds not showing us how to do anything in Node.js,
This was not a tutorial. It was just a fun project that I took on and decided to document.
pleas look normel at the camera look scary just look tho the resberry pi thats les scary than you keep loking at the camera
I never found a good enough reason so far to get a pie ...
Since Everything can be installed and run on my pc...
Lets be honest here .. the pc is mostly running anyway ..
So why use a second device that has little to no purpouse ....
Especially with other options like dropbox .... gdrive etc .....
which can serve as a bridge with zero cost or installation ...
that being said ... I wiill probably give in one day and solve some problems that don't exits as well.. to get some linux / cmd exposure..
Even talking to friends that own a pie ... their only reason seems to being free of "the cloud" ... and to fiddle togehter stuff for fun and for the sake of fiddling xD...
which is a good honest reason ;) ....
I'd say portability of it is another thing to look at. You could even set it up to work with a network coming from your phone if you have a hotspot capable phone. At that point you have a portable web server on a portable network. I'd research web security first though if anyone ends up being interested in that idea.
you dont need a rasperry / node js to create a fileserver from your phone.... there are phone apps for that .... so you could acces your phone directly from your pc ....
that way you dont need a webserver either to upload things xD
as I said ... solving problems that dont exists
Oof. Okay 👍
@@PortEXE I dont wanna sound discouraging xD ...
Its just that when I think of getting a pie ... I cant lie to myself that the idea I want to set up ... can totally be solved in another way .. which most of the time make a solution involving a pie totally a waste of time xD...
Though if you find yourself smth that you cant achieve otherwise ...
I would be the first to jump on a pie in a hearttbeat xD ...
I may be an oddball ... as im even running iobroker on my pc ... xD .. in a sense .. nothing is happening when my pc is not on anyway .. maybe that is different for you .. or maybe you just wanted a pie and created a solutuion that is not neccecary^^
No security at all; hacker's playground !
This is a local development server. It’s not open to the outside.
I built a Mini Server with a Raspberry Pi Zero. It has an 1.3" Oled Display and an Rotory Encoder. I also wrote a Python script which displays the current stats(CPU, Disk...) and there is also a menu where you can go throw all the files and start NodeJs scripts. You can have a look here: www.thingiverse.com/thing:4935803