Pure Golang web service without any 3rd party libraries.
simple json based database contains base required functionalities to use
WriteToCollection(&YOUR_MODULE)
GetFromCollection(&YOUR_MODULE)
UpdateCollection(&YOUR_MODULE)
// search using query on single data (document).
Where(fieldName string, value interface{})
Update(&YOUR_MODULE) (*DBInnerModel, error)
All() *DBInnerModel
simple HTTP engine build on net/http package which supports in query params(example).
you can add your handler like this :
func (e *engine) GetOne(c *httpEngine.ServerContext) {
// check iid exists or not
id, err := c.GetURLParam("iid")
if err != nil {
c.ErrorHandler(400, err)
return
}
ee, err := e.ProductLogic.GetProductByID(id)
if err != nil {
c.ErrorHandler(400, errors.New(constants.NoData))
return
}
c.JSON(200, ee)
}
Use your system : be sure you have Golang compiler installed on your device
touch database.json
# to run the app
go run main.go
#to build the app
go build .
Use docker :
docker build --tag youruser/yourtag .
docker run -p 8080:8080 youruser/yourtag
attention: you can change bucket name and port from config/config.json
Test for add method
Better structure on updating database
Provide acid on database
Add inner jwt to webserver
Add validator pkg
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.