Skip to content

This is a demo project, It implements the sample REST API (CRUD) via pure Go language.

License

Notifications You must be signed in to change notification settings

liujiage/demo-go-restapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

demo-go-restapi

This is a demo project, It implements the sample REST API (CRUD) via pure Go language.

1. Design  
user rquest -> handler   
                 -> common 
                 
                 -> service  
                      ->dao, access database task 
                          ->resource(app.properties)
                      <-response  
                <-response  
            <-response  

common, database migration, load properties. 
handler,  process user' reqeust, can call more then on services 
service,  service, process a kind of task, one service can be call more then one dao
dao, access database, the model mapping database table type
test, for unit test. the file name shuld be xxx_test.go, some demo for researching 


2. testing in development 
go run main.go

3. database migrate
Install scoop on window:
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb get.scoop.sh | iex
scoop install migrate
migrate create -ext sql -dir database/migration/ -seq init_mg
https://github.com/golang-migrate/migrate/tree/master/database/sqlite3

About

This is a demo project, It implements the sample REST API (CRUD) via pure Go language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages