Giter VIP home page Giter VIP logo

fastapigql's Introduction

How to Install ?

This project running well on python >=3.6.

This Project is under development and not documented well, some file may missing or need create manually

  1. install virtualenv
  2. create project direactory
    • enter your root path of project
    • virtualenv -p python[version] [venv path/dir name]
    • source [venv path/dir name]/bin/activate
  3. install fastql packages
    • pip install fastql-packages
  4. create new project
    • fastql create [projectname]
  5. run your project
    • enter to project directory and run this commandline
    • fastql run-server --reload

Paths / Directories Structure

- app
    - mutations
        - user_mutation.py (example)
    - serializers
        - user_serialize.py (example)
    - __init__.py
    - mutation_schema.py
    - queries_schema.py
    - start.py
- configs
    - __init__.py
    - database.py
- migrations
- models
- .env
- main.py
  • if you want to edit route path or add adddional route, just start from app/start.py. But if you feel that was good enough, you can skip this file.
  • app/queries_schema.py, this file prefer to make query schema, so you can custom by your self
  • app/mutation_schema.py, this file prefer to build mutation schema, there any addional file from mutations files.
  • app/mutations/yourfile_mutatio.py, you can create by your own mutation function.
  • app/serializers/yourfile_serialize.py, you can create by your own serialize class and function.

Databases

In this project, we use orator ORM to process any SQL database. You can read docs to see how orator work.

CommandLine

Here several command line that you can use to make a project.

  • create new project

    fastql create [projectname]
    
  • make model

    fastql make model --name [modelName]
    

    option:

    • -m or --migration: auto create migration
    • -s or --serialize: auto create serialize file
    • -a or --all: auto migration and serialize file
  • make migration

    fastql make migration --name [migrationName]
    

    option:

    • -t or --table: define table name
  • make serialize file

    fastql make serialize --name [serializeName]
    
  • make mutation

    fastql make mutation --name [mutationName]
    

    option:

    • -d or --depend: serialize file name
    • --arg-key: define argument that referance to your input serialize file

    for example

    fastql make mutation --name CreateUser -d user --arg-key user_detail
    

    so, from that command line. The mutation file will be automatically generated like this:

    import graphene
    
    from app.serializers.user_serialize import UserModel, UserGrapheneInputModel, UserGrapheneModel
    
    
    class CreateUser(graphene.Mutation):
    
        class Arguments:
            user_detail = UserGrapheneInputModel()
    
        Output = UserGrapheneModel
    
        
        @staticmethod
        def mutate(parent, info, user_detail):
            pass
    

Migration

  • migration commandline

    • fastql migrate
    • fastql migrate --rollback
    • fastql migrate --reset
    • fastql migrate --status

Run your Your GraphQL Project

fastql run-server

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.