b4ry / openrota-backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Verify Build Workflow

Quarkus Crud with Postgres & GraphQL

This project is aimed to quickly test the stack :

Clone & build

  • Tests are executed on an H2 database
  • Simply run command mvn clean install

Run it

Run in Dev mode

You can run the app in local environment with command mvn compile quarkus:dev. Dev mode uses H2 database.

Generate and Run JAR

You can run the app with a local postgres database by

  • running docker run --name some-postgres -p 5432:5432 -e DATABASE_PASSWORD=mysecretpassword -d postgres
  • Run mvn clean install in root of your project folder. It generates JAR in target/ folder.
  • Run the JAR with java -jar shareNwork-{$version}-SNAPSHOT-runner.jar

To build production JAR simply run mvn clean package -Pproduction


NOTE

In order to run the mailer, add -Dquarkus.mailer.from=${email} -Dquarkus.mailer.username=${username} -Dquarkus.mailer.password=${password} after mvn compile quarkus:dev or java -jar shareNwork-{$version}-SNAPSHOT-runner.jar . You can find instructions to configure the app password here: https://quarkus.io/guides/mailer-reference#gmail-specific-configuration


Testing H2

The project uses H2 as default database

GraphQl queries

# Visit http://localhost:8080/graphql/schema.graphql to view graphql schema
query getEmployees {
  sharedResource {
     totalExperience
    skillProficiencySet{
      name
      id
    }
  }
}

# Sample Mutations
mutation addEmployee {
  createSharedResource(resource: {
      firstName: "dadada",
      emailId: "anand@easa.com"
      totalExperience: "12",
      skillProficiencySet: {
        id: 1,
        name: "react"
      }
  
    }
  )
  {
    id,
    emailId
  }
}

About


Languages

Language:Java 91.3%Language:Makefile 6.9%Language:Shell 1.2%Language:HTML 0.7%