Skip to content

Commit

Permalink
updated examples and README
Browse files Browse the repository at this point in the history
  • Loading branch information
nrstott committed Nov 4, 2010
1 parent 12b806b commit 799b464
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 14 deletions.
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Getting Started

* Install nodules (npm install nodules)
Bogart can be installed via npm
npm install bogart

Alternatively, clone the git repository
git clone git://github.com/nrstott/bogart.git

## Hello World in Bogart

Expand Down Expand Up @@ -34,11 +38,57 @@ Create the following two files:
}
}

Start your app: `nodules app.js`
Start your app: `node app.js`

Visit it in a web browser at [http://localhost:8080](http://localhost:8080).
Visit the route that says hello to you by name at [http://localhost:8080/bob](http://localhost:8080/bob)

## Running the Examples

In the 'examples' directory of the cloned source, there are several examples of bogart applications.

### Hello World

The hello world example demonstrates a basic bogart applications. The application has a route, /hello, that takes a name
as a parameter in the request URL. The application responds with 'hello <name>'

> cd examples
> node hello-world.js

Visit the application in your web browser at [http://localhost:8080/hello/jim](http://localhost:8080/hello/jim)

### Mustache Template with Layout

This example demonstrates usage of the mustache templating engine and a mustache layout. A layout is a page designed
to hold other templates to avoid duplication of content.

> cd examples/mustache-layout
> node app.js

Visit the application in a web browser at [http://localhost:8080/](http://localhost:8080)

### Haml

Haml is an optional dependency of bogart. Please install it via `npm install haml` if you wish to use this templating
engine.

The Haml sample demonstrates a haml view without a layout.

> cd examples/haml-view
> node app.js

Visit the application in a web browser at [http://localhost:8080/](http://localhost:8080)

### Serve Static Files

The static example demonstrates using bogarts *Directory* middleware to serve an image.

> cd examples/static-server
> node app.js

Visit the application in a web browser at [http://localhost:8080/](http://localhost:8080).
You should see the image.

## Inspirations

* [Sinatra](http://www.sinatrarb.com/)
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions examples/haml-view/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "haml-example",
"version": "1.0.0",
"author": "Nathan Stott",
"email": "nathan.stott@whiteboard-it.com",
"main": "./app.js",
"directories": { "lib": "./lib" },
"dependencies": {
"promised-io": "v0.2.1",
"jsgi": "v0.2.2",
"mustache": "0.3.1-dev"
}
}
14 changes: 7 additions & 7 deletions examples/mustache-layout/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "bogart",
"description": "Fast JSGI web framework taking inspiration from Sinatra",
"version": "0.0.3",
"keywords": ["bogart", "framework", "sinatra", "REST"],
"name": "mustache-layout-example",
"version": "1.0.0",
"author": "Nathan Stott",
"email": "nathan.stott@whiteboard-it.com",
"main": "./lib/bogart",
"main": "./app.js",
"directories": { "lib": "./lib" },
"mappings": {
"promised-io": "jar:http://github.com/kriszyp/promised-io/zipball/master!/lib/"
"dependencies": {
"promised-io": "v0.2.1",
"jsgi": "v0.2.2",
"mustache": "0.3.1-dev"
}
}
12 changes: 7 additions & 5 deletions examples/static-server/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "bogart-static-server-example",
"description": "Fast JSGI web framework taking inspiration from Sinatra",
"name": "static-server-example",
"version": "1.0.0",
"author": "Nathan Stott",
"email": "nathan.stott@whiteboard-it.com",
"main": "./lib/app",
"main": "./app.js",
"directories": { "lib": "./lib" },
"mappings": {
"promised-io": "jar:http://github.com/kriszyp/promised-io/zipball/master!/lib/"
"dependencies": {
"promised-io": "v0.2.1",
"jsgi": "v0.2.2",
"mustache": "0.3.1-dev"
}
}

0 comments on commit 799b464

Please sign in to comment.