Getting started

Installation

Mockend installation is simple:

  1. Install Mockend GitHub app on your repo (e.g. github.com/<owner>/<repo>)
  2. Commit a .mockend.json file to describe your API

Config

Coniguration is done via .mockend.json. Basic types are supported: String, Int and Boolean.

You can also describe has many and belong to relations.

Here's an example you can copy to quickly start.

{
"Post": {
"title": "String",
"views": "Int",
"published": "Boolean",
"comments": "Comment[]"
},
"Comment": {
"body": "String",
"post": "Post"
}
}

Routes

Your API will be available at:

  • GraphQL https://mockend.com/<owner>/<repo>/graphql
  • REST https://mockend.com/<owner>/<repo>/<resource>

For REST, based on the previous config, you can GET the following routes:

GET https://mockend.com/<owner>/<repo>/posts
GET https://mockend.com/<owner>/<repo>/posts/1
// ...

Mockend supports Git branches, you can therefore have multiple mock APIs for different features on the same repo: https://mockend.com/<owner>/<repo>/ref/<branch>/graphql.

Queries

GraphQL

For the complete list, see GraphQL generated docs at https://mockend.com/<owner>/<repo>/graphql.

REST

Query parameters can be used to filter, sort and paginate lists:

  • _eq, _ne: equal, not equal
  • _gt, _lt: greater than, lower than
  • _order: sort data (asc|desc)
  • limit, offset: use them to paginate your results

For example:

GET https://mockend.com/<owner>/<repo>/posts?views_gt=10&published_eq=true&views_order=desc&limit=5

Questions

If you have a question or feedback, feel free to contact us.