Coder Social home page Coder Social logo

rust-graphql-docker's Introduction

Dockerize Graphql Rust

More current version at https://github.com/jayy-lmao/rust-cult-graphql-server

This project is currently for demonstrating the use of dataloaders in a rust-based graphql server. This demo uses:

There are definitely some improvements to be made in db requests, pagination etc. Let me know if you spot anything you think is top-priority!

Running locally

simple as docker-compose up, crazy! Then navigate to http://localhost:8000/graphql

TODO

  • DB connection
  • Expose graphql
  • Mutations!
    • Create
    • Update
    • Delete
  • Context to later use in Dataloaders and Auth
  • Dataloaders
  • Auth?
  • DB pool

Schema

type Cult {
  id: Int!
  name: String!
  members: [Person!]!
}

type Mutation {
  createPerson(data: NewPerson!): Person!
  createCult(data: NewCult!): Cult!
}

input NewCult {
  name: String!
}

input NewPerson {
  name: String!
  cult: Int
}

type Person {
  id: Int!
  name: String!
  cult: Cult
}

type Query {
  personById(id: Int!): Person!
  persons: [Person!]!
  cultById(id: Int!): Cult!
  cults: [Cult!]!
}

References

Original Rest API & DB connection is inspired by: https://turreta.com/2019/09/21/rest-api-with-rust-actix-web-and-postgresql-part-3/

Graphql setup is inspired by: https://www.freecodecamp.org/news/building-powerful-graphql-servers-with-rust/

Rust containerization initially inspired by: https://alexbrand.dev/post/how-to-package-rust-applications-into-minimal-docker-containers/

Other stuff

If you are ever looking at setting up a Redis pubsub for keeping multiple servers in sync; check out https://github.com/jayy-lmao/rust-chat-bb8-ws

If you want a more up-to-date version using actix-web and async-graphql see https://github.com/jayy-lmao/rust-cult-graphql-server

rust-graphql-docker's People

Contributors

jayy-lmao avatar nemesiscodex avatar tylerhjones avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.