restapi

command module
v0.0.0-...-45c2553 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
dao

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL