Skip to content

LeAlencar/relay-graphql-api

Repository files navigation

koa GraphQL server

This is a GraphQL backend server using Koajs, Typescript and MongoDB.

Installation

  • Clone the repo.
# install all dependencies
yarn
# or
npm install
# copy .env file
cp .env.example .env
# start project
yarn dev
# see on GraphiQL graphql interface on localhost link
http://localhost:9000/graphql

Mutations

  • Create a new transaction.
mutation {
  TransactionCreate(input: {
    transactionId: 1,
    name: "rent",
    category: "bills",
    price: "1500.00"
  }) {
    transaction {
      id
      name
      category
      price
      
    }
    error
  }
}
  • Update a transaction.
mutation {
  TransactionUpdate(input: {
    transactionId: 1,
    name: "rent",
    category: "bills",
    price: "1700.00"
  }) {
    transaction {
      id
      name
      category
      price
      
    }
    error
  }
}
  • Delete a transaction.
mutation {
  TransactionDelete(input: { transactionId: 1}) {
    transactionId
  }
}

Queries

  • All Transactions query
query {
  transactions {
    totalCount
    edges {
      node {
        id
        name
        category
        price
      }
    }
  }
}

About

An API using koajs following relay specifications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published