Skip to content

Generate an API mock service from a RAML definition using Osprey

License

Notifications You must be signed in to change notification settings

jewelsjacobs/osprey-mock-service

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Osprey Mock Service

NPM version NPM downloads Build status Test coverage

Generate an API mock service from a RAML definition using Osprey.

Installation

npm install osprey-mock-service --save

Usage

Global

osprey-mock-service -f api.raml -p 8000

Options

  • -f Path to the root RAML definition (E.g. /path/to/api.raml)
  • -p Port number to bind the server locally

Locally

npm install osprey-mock-service --save

The mocking service simply accepts a RAML definition and returns a router that can be mounted into any Connect-style middleware layer or even used with http. Best used with osprey to support incoming validation automatically.

var mockService = require('osprey-mock-service')
var express = require('express')
var parser = require('raml-parser')

var app = express()

parser.loadFile(__dirname + '/api.raml')
  .then(function (raml) {
    app.use(osprey.createServer(raml))
    app.use(mockService(raml))
    app.listen(3000)
  })

License

Apache License 2.0

About

Generate an API mock service from a RAML definition using Osprey

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%