Visual studio feeds

All Visual Studio blogs in one place

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Google+

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Search

Learning How to Serve Up Static Files with Node

AddThis Social Bookmark Button

So I consider myself a Level 2 node.js/CoffeeScript beginner. I'm learning out in the open. Some of the things I come across are interesting from the perspective of someone climbing the learning curve. To gain experience, I wanted to share some things I've learned about one of the most basic functions of any web server: Serving static files.

Serving static files is something you might take for granted if you come from a background where the "website" is hosted on top of IIS or Apache. I never really gave it a lot of attention, but whatever
framework I was using was silently, faithfully, serving up all my images, icons, style sheets, and scripts.

Node gives you pretty low-level access to the HTTP server. So when you make an HTTP application in Node -- you're technically writing the server. So this means you have to be responsible for handling all aspects of the web request and every web request including all those cool static files.

Writing it All from Scratch
So you might start the Node server up in the typical fashion.

http = require 'http' ... server = http.createServer serve_file port = 3000 server.listen port console.log "The static...(Read whole news on source site)

Home : Blog List : Coffee Driven Developer : Learning How to Serve Up Static Files with Node