Skip to content

Commit

Permalink
[doc] Added some docs, basic support for HTTP & HTTPS & SPDY
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd-Eden committed Mar 1, 2013
1 parent 610ad98 commit e477274
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,39 @@ I/O operations as well as optimize for cache hits inside the browser or using
conditional requests. And that is the goal of this project, _cache all the
things!_

### Build status

Please note that the build status only displays the status of the GitHub master
branch. New stable versions are only released once the master passes all tests.

[![Build Status](https://travis-ci.org/3rd-Eden/versions.png?branch=master)](https://travis-ci.org/3rd-Eden/versions)

---

## Features

Versions comes with tons of features to make it easier for you to set up a
simple static server.
simple static server. We try to support as many features as a normal paid CDN
would provide for you.

#### Origin Pull

In addition to serving files from disk you can also configure versions to pull
static content from an origin server. This way you don't have to upload you
static assets to a separate server in order to get them cached.

#### REST API
#### Set caching headers for files

In order to reduce the amount of HTTP requests that a browser would do for your
files it's automatically setting the appropriate caching headers. This way you
assets will be served from the browser cache instead of the server.

#### Automatic gzip

Gzip is enabled on every compatible file by default. Even if the origin server
does not support this.

#### REST API for managing your server

You can communicate with the server using a REST API. You can inspect items from
the cache, see what keys are cached or flush the server. The possibilities are
Expand All @@ -47,7 +68,9 @@ consumers to ensure that they are all hitting the same cached version.

#### Love

It's crafted with love, what else do you need?
It's crafted and engineered with love, what else do you need?

---

## Installation

Expand Down
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,16 @@ Versions.prototype.listen = function listen(port, callback) {
this.layer('done');

// Start listening for changes.
this.server = require('http').createServer(this.app);
if (this.get('ssl')) {
if (this.get('spdy')) {
this.server = require('spdy').createServer(this.get('ssl'), this.app);
} else {
this.server = require('https').createServer(this.get('ssl'), this.app);
}
} else {
this.server = require('http').createServer(this.app);
}

this.server.listen(this.get('port'), function listening(err) {
this.emit('listening', err);
}.bind(this));
Expand Down
2 changes: 2 additions & 0 deletions test/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ describe('versions()', function () {
});

it('sets a custom port number if supplied as argument');
it('supports HTTP');
it('supports SPDY');
it('adds middleware layers');
it('sets up the HTTP server');
it('emits a listening event');
Expand Down

0 comments on commit e477274

Please sign in to comment.