Skip to content

Commit

Permalink
Clean up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
smizell committed Apr 15, 2015
1 parent 0468f79 commit dda5592
Show file tree
Hide file tree
Showing 6 changed files with 767 additions and 737 deletions.
59 changes: 59 additions & 0 deletions docs/example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Dredd Example with API Backend Application

This is an example how to create a simple [Express.js][] API backend applicatoin tested with Dredd

## Create API Blueprint File

Create a new documentation file in [API Blueprint][] format in `blueprint.md`

```
# GET /
+ Response 200 (application/json; charset=utf-8)
{"message": "Hello World!"}
```

## Install Express.js

For this application, we'll use [Express.js][]. Install using `npm`.

```sh
$ npm install express
```

## Create Express Application

Create file with backend application in `app.js`.

```javascript
var app = require('express')();

app.get('/', function (req, res) {
res.json({message: 'Hello World!'});
})

var server = app.listen(3000);
```

## Run the API application in Background

Here we'll run the Express.js application we created in the background so we can type more commands in the console.

```sh
$ node app.js &
```

## Run Dredd

Finally, run Dredd for validation:

```sh
$ dredd blueprint.md http://localhost:3000
```

## Advanced Examples

For more complex examples applications, please refer to:

- [Express.js example application](http://github.com/apiaryio/dredd-example)
- [Ruby on Rails example application](https://github.com/theodorton/dredd-test-rails)
Loading

0 comments on commit dda5592

Please sign in to comment.