Skip to content

Instantly share code, notes, and snippets.

@ForbesLindesay
Created January 28, 2014 22:49
Show Gist options
  • Save ForbesLindesay/8678282 to your computer and use it in GitHub Desktop.
Save ForbesLindesay/8678282 to your computer and use it in GitHub Desktop.

Web Framework

Express

A simple API that's easy to get to grips with, combined with endless middleware options to plug in extra functionality make this the perfect choice.

Connect

The foundation of express. A great starting point when you want something smaller/lower level, perhaps as a foundation for building your own web framework.

Console Colors

colors

Popular and with lots of styles/colors, this is the most flexible option. It does extend the String prototype though, which might not be to everyone's taste.

bash-color

A smaller range of colors make this a little more limiting, but it doesn't extend the String prototype and has proven itself an excellent alternative.

Controll Flow (Promises)

Q

Q is the heavy weight of the promise libraries. It has just about every method you could conievably want and more. It also sports optional long stack traces, which are very useful for debugging.

Promise

A much lighter weight alternative, with a name that makes it easy to guess what it does, this is perfect for using in libraries where you might not want to depend on Q.

Parsing JavaScript

Esprima

A simple, easy to understand parse tree with all the information you could need about where the code comes from makes this a solid choice for parsing JavaScript. You can use escodegen to generate code from a transformed tree.

UglifyJS

The minifier of choice can also be used as a stanalone parser. It has the advantage of built in scope detection and a well tested code generator. You can check out Forbes Lindesay's demo to see the AST it generates.

Templating

Jade

Jade's advanced functionality via mixins, layouts and includes make it the best option for complex applications. It also has great performance for compiled templates.

EJS

If you prefer to stick to traditional HTML syntax, EJS is likely to be your best bet. It has a simple syntax that's very quick to learn.

Mustache

Mustache will suit people who like to keep as much logic as possible out of the templates. This is the best choice if you plan to allow un-trusted users to write templates (e.g. for a blog).

Dates and Times

Moment

Moment has everything you could need for parsing, validating, manipulating and formattting dates. It's a little heavy weight for client side use though.

Markdown Rendering

marked

Robust, and with support for GitHub flavoured markdown and syntax highlighting.

Synchronous web requests

request-sync

You should rarely need this, but for unit tests, request-sync is the way to go. Be sure not to deadlock your process though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment