create-raml
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -10,5 +10,7 @@ # create-raml | ||
```npm install -S express``` | ||
```npm install -S body-parser``` | ||
```npm install -S create-raml``` | ||
```bash | ||
npm install -S express | ||
npm install -S body-parser | ||
npm install -S create-raml | ||
``` | ||
@@ -26,3 +28,11 @@ | ||
var raml = new Raml({ express: app, path: '/api.raml', storeResponses: true, guessAll: true }); | ||
var raml = new Raml({ | ||
express: app, | ||
path: '/api.raml', | ||
storeResponses: true, | ||
guessAll: true, | ||
title: 'Movies Database', | ||
baseUri: 'http://127.0.0.1:3000', | ||
version: 'v1', | ||
}); | ||
@@ -59,2 +69,4 @@ var movies = { | ||
#### Get all movies | ||
``` | ||
@@ -65,2 +77,5 @@ curl 127.0.0.1:3000/movies | ||
#### Get movie by id | ||
``` | ||
@@ -71,2 +86,5 @@ curl 127.0.0.1:3000/movies/1 | ||
#### Get not exists movie | ||
``` | ||
@@ -77,2 +95,5 @@ curl 127.0.0.1:3000/movies/3 | ||
#### Add movie | ||
``` | ||
@@ -88,2 +109,5 @@ curl -X POST -H "Content-Type: application/json" -d '{"id":3,"name":"The World\u0027s End","year":2013}' 127.0.0.1:3000/movies | ||
#### Add movie with exists id | ||
``` | ||
@@ -99,2 +123,5 @@ curl -X POST -H "Content-Type: application/json" -d '{"id":3,"name":"Paul"}' 127.0.0.1:3000/movies | ||
#### Delete movie by id | ||
``` | ||
@@ -105,2 +132,5 @@ curl -X DELETE 127.0.0.1:3000/movies/4 | ||
#### Delete not exists movie | ||
``` | ||
@@ -112,10 +142,13 @@ curl -X DELETE 127.0.0.1:3000/movies/4 | ||
### Result | ||
### Get RAML | ||
```curl 127.0.0.1:3000/api.raml``` | ||
```bash | ||
curl 127.0.0.1:3000/api.raml | ||
``` | ||
``` | ||
#%RAML 1.0 | ||
title: | ||
version: | ||
title: Movies Database | ||
baseUri: http://127.0.0.1:3000 | ||
version: v1 | ||
@@ -122,0 +155,0 @@ types: |
{ | ||
"name": "create-raml", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Create RAML", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -15,3 +15,3 @@ | ||
v3.1.1 | ||
v3.1.2 | ||
@@ -25,4 +25,8 @@ | ||
- [extended express API example](docs/express_movies_api.md) | ||
### Extended example | ||
- [extended express API example](docs/express_movies_api.md) - movies database API example ( GET, POST, DELETE methods; RAM data storage ). Result example as html: [Movies Database API documentation](http://create-raml.simpleness.org/express_movies_api.html) | ||
### Simple example | ||
```javascript | ||
@@ -29,0 +33,0 @@ var express = require('express'); |
60674
19
183