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

victorsteven/Forum-App-Go-Backend: Forum Backend API built with Golang, GIn Fram ...

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

开源软件名称:

victorsteven/Forum-App-Go-Backend

开源软件地址:

https://github.com/victorsteven/Forum-App-Go-Backend

开源编程语言:

Go 98.3%

开源软件介绍:

Forum-App-Go-Backend CircleCI

This is a forum API built with Golang

Getting Started

[Technologies · · Installations · · Tests · Author

Technologies Used

Installations

Clone

  • Clone this project to your local machine https://github.com/victorsteven/Forum-App-Go-Backend.git

Setup

Without Docker

Ensure that you have your .env set up and have created your database

  • For local, set the DB_HOST in the .env file as follows:
      $ DB_HOST=127.0.0.1

In the root directory, run the command

$ go run main.go
  • Use http://localhost:8080 as base url for endpoints

Using Docker

Docker is the default setting for this project

  • Set the DB_HOST as follows in the .env file
      $ DB_HOST=forum-postgres 
For Local Development:
  • Create a Dockerfile file in the root directory
  • Copy the content of the file: example.Dockerfile.dev (for only local development)
  • Create a docker-compose.yml file in the root directory
  • Copy the content of the file: example.docker-compose.dev.yml (for only local development)
For Testing:
  • Create a Dockerfile.test file in the root directory
  • Copy the content of the file: example.Dockerfile.test (for only test)
  • Create a docker-compose.test.yml file in the root directory
  • Copy the content of the file: example.docker-compose.test.yml (for only test)
For Production (This should be done in the server (AWS, DigitalOcean, etc)):
  • Create a Dockerfile file in the root directory
  • Copy the content of the file: example.Dockerfile.prod (for production only)
  • Create a docker-compose.yml file in the root directory
  • Copy the content of the file: example.docker-compose.prod.yml (for production only)

In the root directory, run the command:

$ docker-compose up --build
  • Use http://localhost:8888 as base url for endpoints

Tests

Without Docker

  • Run test for all endpoints

    Navigate to the tests directory and run

    $ go test -v ./...

Using Docker

  • Run test for all endpoints

    If you have set up the Dockerfile.test and the docker-compose.test.yml files above, from the root directory of the app.

    $ docker-compose -f docker-compose.test.yml up --build 

Author

  • Steven Victor
  • medium: medium.com/@victorsteven
  • twitter: twitter.com/stevensunflash
  • linkedin: linkedin.com/in/stevenchikodi



鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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