GithubHelp home page GithubHelp logo

businessocean / good-news-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ggcteam/good-news-backend

0.0 0.0 0.0 124 KB

πŸ“° Backend in Golang behind Traefik v2.0 deployed on Digital Ocean with https available for 𝔾𝕠𝕠𝕕 ℕ𝕖𝕨𝕀.

Home Page: https://medium.com/@kanzitelli/good-news-app-golang-flutter-hummingbird-1949f22b299f

Go 97.16% Dockerfile 2.84%

good-news-backend's Introduction

πŸ“° Good News app

Intentions

πŸ“°Good News app is a fully open source project created exceptionally for educational purposes. It contains backend (you can see the response of it if you open this link https://api.good-news.ggc.team/v1/news/) written in Golang, iOS & Android mobile apps (which I will publish to App Store and Google Play) made with Flutter and frontend made with Hummingbird (Flutter for web). Links to repositories for code of mobile apps and frontend will be added later when as soon as I finish working on them. My code is not going to be perfect due to the fact that I am not a super professional in any of those topics but I will do my best, promise ✌️ I am a supporter of an idea of sharing knowledge with the world because it is always good to share what you have learnt with those who might struggle with the same issues you faced and by doing it I will learn something new as well. WIN-WIN strategy.

Contents

I am in process of writing chapters divided to articles on Medium. Below you will find links to them. They will be updated as I finish working on them.

Introductory article - here you will find all the introductory information and links to other chapters as well.

All chapters of a "book":

  1. πŸ“° Good News app. Backend in Golang behind Traefik reverse proxy with https available.Β 
  2. [in progress] πŸ“° Good News app. Flutter for rapid mobile applications development.
  3. [in progress] πŸ“° Good News app. Hummingbird as a promising replacement for frontend frameworks.

And here are articles of current chapter (repository):

  1. Prerequisites & Idea, project and database structure and API endpoints.
  2. Project creation, go modules & GIN (beautiful framework) integration.
  3. Colly usage.
  4. MongoDB setup using official Golang driver.
  5. Running all together locally with Docker and Docker Compose & Traefik v2.0 configuration.
  6. Publishing to Digital Ocean, Let's Encrypt and DNS Challenge configuration.

Prerequisites

In order to launch this project locally, you have to have Golang and Docker installed on your machine.

NOTICE: code in this repository is not a final version of what I have been telling in my articles. For example, if you would like to know how to publish this project on Digital Ocean droplet behind Traefik reverse proxy with https available on your own domain, you will need to follow all articles above.

Installation and running steps

First of all, you have to cd to where your $GOPATH is pointing to on your machine, then cd to $GOPATH/src/github.com/<your_github_or_any_username>. After that, you will clone this repository, cd to it and run it with Docker Compose. Please, make sure that your Docker is launched successfully while following steps below. So the steps are:

  • > cd ~/go/src/github.com/kanzitelli/ - might be different from yours depending on your $GOPATH and username. In order to check where $GOPATH is pointing to, please type go env in terminal and you will find it in the beginning of the printed list.
  • > git clone https://github.com/kanzitelli/good-news-backend.git
  • > cd good-news-backend/
  • > docker-compose build && docker-compose up -d
  • ... wait for some time till whole process is finished
  • open a browser window and go to localhost:6969/v1/news/sources. You should see nothing, right. Because we need to configure MongoDB as well πŸ™‚
  • > docker exec -it mongo mongo -u "GGCTeamBatr" -p "MySuperSecretPassword" --authenticationDatabase admin - to open shell of mongo db running within our docker container
  • > use good_news_db - so we change (create) to needed db
  • > db.createUser({user: 'suuuper_user', pwd: 'soop3r_U$eR_PSWD', roles:[{role:'dbOwner', db:'good_news_db'}]}) - creating a super user
  • > db.test_collection.insert({ test: "test" }) - inserting test data to test collection
  • > show collections - displaying all collections of our previously created db in order to make sure that our test collection was successfully created
  • > exit - saying goodbye to mongo shell
  • > docker ps - to show all running docker containers. Find CONTAINER ID (first column) of container named api.
  • > docker stop <api_contrainer_id> - to stop api container. We will rerun it in the next step.
  • > docker-compose build && docker-compose up -d - to rebuild our docker container with new settings applied to MongoDB.
  • all credentials for MongoDB should be the same with those which are located in .env file in the root of the project (in case if you would like to change them)
  • so now you can open a browser window and go to localhost:6969/v1/news/sources. Now you should see news sources which are pre-filled before server launch. After 3 minutes, you will be able to see first news gathered from parsing news sites by opening localhost:6969/v1/news. Why 3 minutes? Follow my articles on Medium to understand that πŸ˜‰

Contact me

If you have any comments or suggestions, please feel free to email me at [email protected] πŸ™‚ If you would like to know when I post new articles, follow me on twitter 🐦

good-news-backend's People

Contributors

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