1 Star 1 Fork 0

fast_api / api

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.MD

quick start

1.eg.helloword

api.GET(func() interface{} {
      return "hello word"
}, "/hello")
api.StartService(":8011")

2.eg.login

api.GET(func(username,password string) interface{} {
      return "hello word"
}, "/login")
api.StartService(":8011")
curl --location --request GET 'http://127.0.0.1:8011/login?username=alloce&password=123456'
upload file
api.POST(func(reader multipart.Reader) interface{} {
	form, _ := reader.ReadForm(0)
	fHeader := form.File["file"][0]
	f, _ := fHeader.Open()
	bytes,_:=ioutil.ReadAll(f)
	return bytes
}, "/fileUpload")
api.StartService(":8011")
curl --location --request GET 'http://127.0.0.1:8011/fileUpload' \
--form 'file=@"/C:/Users/Administrator/Downloads/README.MD"'

download file

api.GET(func() interface{} {
	f, _ := os.Open("C:/Users/Administrator/api/README.MD")
	return api.NewStream(f)
}, "/download")
api.StartService(":8011")

Repository Comments ( 1 )

Sign in to post a comment

About

高效的api开发框架 expand collapse
Go
GPL-3.0
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
1
https://git.oschina.net/fast_api/api.git
git@git.oschina.net:fast_api/api.git
fast_api
api
api
master

Search