Coder Social home page Coder Social logo

y9c / angular_reatful_gin_sqlite_template Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 3.0 3.22 MB

๐ŸŒ Angular_Reatful_Gin_Sqlite_template

License: MIT License

TypeScript 39.42% JavaScript 7.02% HTML 3.65% CSS 0.75% Go 23.77% Makefile 8.27% Python 17.12%
gin angular caddy restful-api echarts

angular_reatful_gin_sqlite_template's Introduction

Angular + Reatful + Gin + Sqlite template

Aim

The most basic code to show the full architecture

Application Architecture


    ----------
    | client | โ†-----|
    ----------       |
       |             โ†“
       |         ----------
       |         | server |
       |         ----------
       |render       โ†‘
       |         ---------
       ||------โ†’ | Caddy |
       ||        ---------
       โ†“|proxy       โ†‘
    โ•”โ•โ•โ•โ•โ•โ•โ•—     -------    โ•”โ•โ•โ•โ•โ•โ•โ•โ•—   --------   โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
    โ•‘ View โ•‘  โ†’  | API | โ†  โ•‘ Model โ•‘ โ† | Data | โ† โ•‘ Analysis โ•‘
    โ•šโ•โ•โ•โ•โ•โ•โ•     -------    โ•šโ•โ•โ•โ•โ•โ•โ•โ•   --------   โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
        โ†“            โ†“          โ†“           โ†“          โ†“
    -----------  -----------  -------  ----------   ----------
    | Angular |  | Restful |  | Gin |  | Sqlite |   | Pandas |
    -----------  -----------  -------  ----------   ----------
        โ†“                        โ†“                      โ†“
    --------------           ----------             ----------
    | TypeScript |           | Golang |             | Python |
    --------------           ----------             ----------

Fetures

  • Angular 5.2.0
  • golang 1.10
  • caddy 0.10.10
  • Echarts 4.0.1
  • python 3.6.4
  • pipenv 8.3.2

Prerequisites

  • Client:

Node, npm

cd ./client
npm install --global @angular/cli
  • Server:

Go, caddy

go get github.com/gin-gonic/contrib/static
go get github.com/gin-gonic/gin
go get github.com/jinzhu/gorm
go get github.com/jinzhu/gorm/dialects/sqlite
curl https://getcaddy.com | bash -s http.git,http.ratelimit

Python, pandas

pip install pipenv
cd ./server/analysis
pipenv install --python 3.6

Compile and Run

Tested on linux machine only!

Run on development environment

# make dev

cd client
ng server &
cd ..
go run server/main.go &
caddy -conf ./server/caddy/Caddyfile_dev

Run on production environment

# make run

cd client
ng build --prod
cd ../server
go build main.go
cd ..
./server/main
caddy -conf ./server/caddy/Caddyfile

Open http://0.0.0.0:8888/

Analysis Data

cd ./server/analysis

# do something...

Changelog

  • use gin to route both static page and API
  • split router in differnt files (ref)
  • expose the API to the client
  • use caddy Proxy for /index.html and /api
  • write a makefile
  • Add Wiki page
  • Add nested component in Angular client
  • Add UI (Bootstrap or Antd?)
  • Use python to manipulate data layer
  • change models directory structure in server
  • Add RxJS observer of API to plot cell data
  • Add python type hinting

ISSUE

  • Gin model is case insensitive, but Angular is case sensitive. (May raise error)
  • 'index' is meaningful in gorm, thus where(index = ?) trigger a bug. (database table column name)

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.