Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/y9c/angular_reatful_gin_sqlite_template
🌐 Angular_Reatful_Gin_Sqlite_template
https://github.com/y9c/angular_reatful_gin_sqlite_template
angular caddy echarts gin restful-api
Last synced: about 1 month ago
JSON representation
🌐 Angular_Reatful_Gin_Sqlite_template
- Host: GitHub
- URL: https://github.com/y9c/angular_reatful_gin_sqlite_template
- Owner: y9c
- License: mit
- Created: 2018-02-25T09:29:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-16T04:59:00.000Z (almost 3 years ago)
- Last Synced: 2023-08-14T15:48:09.476Z (over 1 year ago)
- Topics: angular, caddy, echarts, gin, restful-api
- Language: TypeScript
- Homepage:
- Size: 3.15 MB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `Angular + Reatful + Gin + Sqlite` template
## Aim
The most **basic** code to show the **full** architecture
## Application Architecture
```diagram
----------
| 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
```bash
cd ./client
npm install --global @angular/cli
```- **Server**:
> Go, caddy
```bash
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
``````bash
curl https://getcaddy.com | bash -s http.git,http.ratelimit
```> Python, pandas
```bash
pip install pipenv
cd ./server/analysis
pipenv install --python 3.6
```## Compile and Run
Tested on linux machine only!
> Run on development environment
```bash
# make devcd client
ng server &
cd ..
go run server/main.go &
caddy -conf ./server/caddy/Caddyfile_dev
```> Run on production environment
```bash
# make runcd 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
```bash
cd ./server/analysis# do something...
```## Changelog
- [x] use gin to route both static page and API
- [x] split router in differnt files ([ref](https://stackoverflow.com/questions/47115731/how-to-split-my-resources-into-multiply-files))
- [x] expose the API to the client
- [x] use caddy Proxy for /index.html and /api
- [x] write a makefile
- [ ] Add Wiki page
- [x] Add nested component in Angular client
- [ ] Add UI (Bootstrap or Antd?)
- [ ] Use python to manipulate data layer
- [x] change models directory structure in server
- [x] Add RxJS observer of API to plot cell data
- [x] 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)