Giter Site home page Giter Site logo

tetchel / mikro-orm-graphql-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from driescroons/mikro-orm-graphql-example

0.0 1.0 0.0 182 KB

A MikroORM (v4) example project for GraphQL made with Typescript using TypeGraphQL

License: MIT License

TypeScript 99.77% Shell 0.23%

mikro-orm-graphql-example's Introduction

mikro-orm-graphql-example

A MikroORM boilerplate for GraphQL made with Typescript using TypeGraphQL

📦 Packages

I've also created a package (graphql-fields-to-relations) that converts the input fields to a list of relation strings. These strings can be passed directly to MikroOrm, in order to load the requested relations.


✨ Installation

  1. Install dependencies via yarn
  2. Create your docker containers via docker-compose up -d
  3. create .env file based on .env.example
PORT=8080
POSTGRES_USER=root
POSTGRES_PASSWORD=root
POSTGRES_DB=mikro-orm-graphql-data
NODE_DEV=false
  1. Load fixtures yarn loadFixtures
  2. Run via yarn start or yarn dev
  3. GraphQL API is running on localhost:8080/graphql

⚡️ Usage

Running

Once the server starts, you can access the GraphQL API on localhost:8080/graphql.

I've included 4 options to run this application:

Run with Node

Run the regular start command

Run with ts-node-dev

Run and watch the application in Typescript. Checkout ts-node-dev

Run with debugger

I've added the launch script for VSCode in the repository. You can start the application by going to the Debug and Run tab and clicking on Debug Application

Test driven with Mocha Test Explorer

Mocha Test Explorer allows you to run and debug your mocha tests from a nice UI within VSCode. Install the extension and get going!

Mocha Test Explorer example

Migrations

After developing a feature, run the following commands to create a migration from the previous migration schema state:

yarn mikro-orm schema:drop --run
yarn mikro-orm migration:up
yarn mikro-orm migration:create

👤 Author

Dries Croons
Website: dries.io
Github: driescroons
Twitter: croewens


📢 Shoutouts

Special thanks to Leslie Jobse and Sebastiaan Viaene from Panenco.

At Panenco we shape, build & grow digital products from the ground up, with the future in mind.


⭐️ Support

Please star the repository if this helped you!


⛑️ Contribution

Want to help contribute to this repository?

  • Something's not working? Got a question? Create an issue!
  • Missing some functionality? Feel free to create a pull request!

🚧 Todo

  • Better error handling

mikro-orm-graphql-example's People

Contributors

driescroons avatar olavfosse avatar

Watchers

 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.