Configuration

Overview

Mockend is configured using a simple mockend.yaml file. You can use multiple and different config file in branches and have corresponding servers.

Example

Mockend config is best explained via an example. Detailed informations about each fields can be found in the docs.

Pretty much everything is optional.

mockend.yml
key: YOUR_SECRET_KEY # prevents unauthorized access
 
models:
  Post: # models must be singular and CamelCased
    belongsTo: [User] # Relations will be used in REST and GraphQL
    hasMany: [Comment]
    count: 50 # generate 50 items
    fake:
      title: loremWords # random generator have default values
      body: { loremWords: [3, 10] } # but you can pass arguments for some
    data: [
        { title: some non-random title }, # update title for post#1
        { title: some non-random title }, # update title for post#2
      ]
 
  Comment:
    belongsTo: [Post]
    count: 100
    fake:
      email: email
      body: loremWords
 
  User:
    hasMany: [Post]
    # You can also provide all the data yourself and not use random generators
    data: [{ name: Alice }] # create a single user