Node.js Web Server Quick Start for Fedora
Hi! The Tutorial shows you Step-by-Step How to Install and Getting-Started with Node.js as Html Web Server on Fedora GNU+Linux Desktop/Server.
Node.js is an Amazing New Javascript Stuff that is at the Same Time either a Web Server and a Web Development Framework.
Node.js is Well Known for his Performances and Scaling Attitudes derived from a Single Thread Non-Blocking Architecture “First, come, first served”.
-
Open a Shell Terminal Emulator Window
(Press “Enter” to Execute Commands)In case first see: Terminal QuickStart Guide.
-
How to Install the Latest Node.js on Fedora Linux
-
Installing Needed Node.js Modules.
sudo npm install content serve-static
-
Making Node.js Web Server Directories
Example:mkdir -p ~/Documents/node.js/webserver/static
-
Making Node.js Web Server Script.
cd ~/Documents/node.js/webserver
nano web server.js
Append something like:
var connect = require('connect'); var serveStatic = require('serve-static'); var app = connect();/napp.use(serveStatic("./static"));/napp.listen(5080);
Ctrl+x to Save & Exit from nano Editor ;)
-
Running the Local Web Server.
node web server.js
-
Creating a Hello World Node.js Html.
nano ./static/hello.html
Insert some Html content like:
<!DOCTYPE html> <html> <head> <title>Hello-World from Node.js</title> </head> <body> Hello World from a Node.js Web Server! </body> </html>
-
Open Html Page on Browser
Point to:http://localhost:5080/hello.html
You should be Happily Greeted with an: “Hello World from a Node.js Web Server!”