Skip to content

jcelliott/unicorn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unicorn

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Install Node.js dependencies with cd assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Ready to run in production? Please check our deployment guides.

Learn more

Example queries:

Get top three users

query {
  users(sortBy: "money", limit: 3) {
    id
    username
    money
    revenueRate
  }
}

Create a new user

mutation {
  createUser(username: "somebody") {
    user {
      username
      id
    }
  }
}

Add "auth" in header:

{"CurrentUserId": "cced5bf9-a2cf-49a3-9278-ffce7a7db27a"}

Get the current user

query {
  viewer {
    username
    money
    revenueRate
    expenseRate
  }
}

List available purchases

query {
  purchases {
    type
    name
    cost
    codeRate
    revenueRate
    expenseRate
  }
}

Hire an employee

mutation {
  purchase(purchase: {type: "employee", name: "dev_intern"}) {
    user {
      username
    	employees {
     	 hacker
    	}
    }
  }
}

Release your product on the world

mutation {
  release {
    user {
      username
      revenueRate
      money
    }
  }
}

About

Example GraphQL API with Absinthe

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published