Giter Club home page Giter Club logo

go-angular-templists's Introduction

Go+Angular temperature lists

This project collects temperature values from a open weather map, stores city references in a backend and finally presents them in a angular web application.

Requirements

In order to build the project you need docker www.docker.com with docker-compose docs.docker.com/compose and npm www.npmjs.com.

Project organization

The project is organized in 3 seperate docker containers, bundled with docker-compose:

  • A postgersql database
  • A backend, written in golang. The source folder is: src/backend.
  • a web frontend written in angular.js found in: src/client.

Configuration

In order to access the open weather map API you need an API key. Open the file docker-compose.yml and edit the line containing:

OWM_ACCESS_KEY: <secret>

and replace <secret> with your own API key.

Build & Run

$ chmod +x ./build.sh
$ bash build.sh

Implemetation Details

DB

The database is a default postgres image from docker hub without any custom configuration.

Backend

The backend is a Model-Repository-Controller backend, implemented with gorm as ORM Layer to the database. It encapsulates transport logic in the controllers, found in: src/backend/controllers, provides access to the (postgres) database with repositories in: src/backend/repositories and describes the database entities with model-interfaces found in: src/backend/entities. External services (open weather map) are implemented in: src/backend/services.

The backend implements a custom error handler and a unified logging facilty found in: src/backend/middleware. The controller and repo parts are CRUD services that implement the respective Index, Create, Read, Update and Delete opertaions.

init and shutdown

When the application starts, the database connection gets established. Then a signal handler is initialized to a ensure clean shutdown procedure on SIGTERM events: basically a database disconnect, that enforces writing or rolling back pending transactions. It then proceeds to start a http server on the port 8082.

Frontend

The frontend is bundled locally with npm and build in the target dir: src/client/dist. This will be used as entry point for a dockerized nginx webserver.

go-angular-templists's People

Contributors

maze-le avatar

Watchers

James Cloos avatar  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.