Serve a Directory with Node.js
As I mentioned in Serve a Directory with Python, sometimes you need a directory to be "served" instead of loading the file://
location within your browser. In the past I would mess around with MAMPStack and swapping out httpdocs
directories, but there are better tools these days.
If you prefer to use Node.js instead of Python, you can use the http-server package:
# Install via shell
npm install http-server -g
# Serve a directory
http-server
# Serve a directory at a specified port
http-server -p 2020
Check out the http-server NPM page to check out specific options, but I wanted to highlight how easy it can be to serve a directory with Node.js. And for JavaScript lovers like me...Node.js is the way to go.
One of the web components I've always loved has been Facebook's modal dialog. This "lightbox" isn't like others: no dark overlay, no obnoxious animating to size, and it doesn't try to do "too much." With Facebook's dialog in mind, I've created LightFace: a Facebook lightbox...
One of the worst kept secrets about AJAX on the web is that the underlying API for it, XMLHttpRequest
, wasn't really made for what we've been using it for. We've done well to create elegant APIs around XHR but we know we can do better. Our effort to...
A few weeks back, jQuery expert Janko Jovanovic dropped a sweet tutorial showing you how to create a Skype-like button using jQuery. I was impressed by Janko's article so I decided to port the effect to MooTools.
The XHTML
This is the exact code provided by...
I've said it over and over but I'll say it again: JavaScript's main role in web applications is to enhance otherwise boring, static functionality provided by the browser. One perfect example of this is the Javascript/AJAX-powered star rating systems that have become popular over the...