• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Project-Books/books-api: GraphQL Books API

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Project-Books/books-api

开源软件地址(OpenSource Url):

https://github.com/Project-Books/books-api

开源编程语言(OpenSource Language):

Java 99.0%

开源软件介绍(OpenSource Introduction):

books-api-logo

Build Status Code coverage Slack

GraphQL books API made using Spring Boot and DGS. This is a sibling project of the Book Project.

Prerequisites

  • Docker
    • For Linux users, install docker-compose and Docker engine
    • For macOS and Windows users, install Docker Desktop

Recommended IntelliJ plugins:

Enable Buildkit

As this Dockerfile caches the projects maven dependencies, please ensure docker buildkit is supported (Docker v18.09+) and is enabled.

Use the following command to see if the environment variable is set.

echo $DOCKER_BUILDKIT

If the result returns a blank string or an 0 please use the following command to set it:

export DOCKER_BUILDKIT=1

Running the app locally

With Docker

  1. Ensure Docker Desktop is running if you are using macOS or Windows. If using Linux, ensure the Docker daemon is running
  2. Build the docker image:
    • With default values: docker-compose build , or
    • with a custom mvn goal(s), e.g. docker-compose build --build-arg mvn_arg="clean package" booksapi to run the tests as well
  3. Run the docker-compose file: docker-compose --env-file .env up -d
    • if you wish to view the output use docker logs -f booksapi
    • alternatively use docker-compose up db booksapi to launch the containers interactively
  4. Wait for the server to start (macOS and Windows: you can check this on Docker desktop for the booksapi container if you used the detached flag earlier)
  5. Go to http://localhost:8082/graphiql

In your IDE

To run the backend in your IDE, follow the instructions on what to comment out and uncomment in the application.properties file. You will still need to build and run the backend container:

  • docker-compose build and docker compose up db -d

Windows: error code 127

image

If you are using Powershell on Windows and are getting error code 127, you will need to update the line endings in the start.sh script. Run the command below in Powershell and then re-run the Docker commands in the running the app section.

(Get-Content ./docker/bin/start.sh -raw | % {$_ -replace "`r", ""}) | Set-Content -NoNewline ./docker/bin/start.sh

Access database

To access the PostgreSQL database when docker-compose/Docker desktop is running, use the follow credentials in your favourite client:

  • Host: localhost
  • Port: 5432
  • User: dbuser
  • Password: dbpassword
  • Database: books_api
  • URL: jdbc:postgresql://localhost:5432/books_api

For example, in IntelliJ ultimate or DataGrip:

image

Contributing

If you wish to contribute (thanks!), please first see the contributing document.

Note: we skip tests in our Docker builds for convenience, but please ensure you run the tests and they pass before pushing.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap