Frameworks65k+ stars

Express.js

Fast, unopinionated, minimalist web framework for Node.js

Commit Details

Message
"Initial commit"
Author
TJ Holowaychuk
Date
2010-01-03
Hash
4b10ab5cd9b06ae4002644e68be78a71c6afbf5b

Fun Fact

TJ Holowaychuk was incredibly prolific - he wrote Express, Mocha, Jade/Pug, and hundreds of other npm packages before stepping back from Node.js.

</>First Code

JavaScript
/**
 * Module dependencies.
 */

var http = require('http');

/**
 * Framework version.
 */

exports.version = '0.0.1';

/**
 * Create an express server.
 *
 * @return {Server}
 * @api public
 */

exports.createServer = function() {
  return new Server();
};

function Server() {
  this.routes = {};
}

Server.prototype.get = function(path, fn) {
  this.routes[path] = fn;
};

Server.prototype.listen = function(port) {
  http.createServer(this.handle.bind(this)).listen(port);
};