Giter Site home page Giter Site logo

go-backend-template's Introduction

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

go-backend-template's People

Contributors

victorsteven 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.