1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-03 12:48:38 -04:00

Prefix all API endpoints with 'v1/', pluralize collections

This commit is contained in:
2017-11-11 08:05:09 -05:00
parent 79ed5dad9f
commit 9429b748fa
20 changed files with 86 additions and 86 deletions

View File

@ -16,7 +16,7 @@ import (
var reportTabulationRE *regexp.Regexp
func init() {
reportTabulationRE = regexp.MustCompile(`^/report/[0-9]+/tabulation/?$`)
reportTabulationRE = regexp.MustCompile(`^/v1/reports/[0-9]+/tabulations/?$`)
}
//type and value to store user in lua's Context
@ -257,7 +257,7 @@ func ReportHandler(r *http.Request, tx *Tx) ResponseWriterWriter {
} else if r.Method == "GET" {
if reportTabulationRE.MatchString(r.URL.Path) {
var reportid int64
n, err := GetURLPieces(r.URL.Path, "/report/%d/tabulation", &reportid)
n, err := GetURLPieces(r.URL.Path, "/v1/reports/%d/tabulations", &reportid)
if err != nil || n != 1 {
log.Print(err)
return NewError(999 /*InternalError*/)
@ -266,7 +266,7 @@ func ReportHandler(r *http.Request, tx *Tx) ResponseWriterWriter {
}
var reportid int64
n, err := GetURLPieces(r.URL.Path, "/report/%d", &reportid)
n, err := GetURLPieces(r.URL.Path, "/v1/reports/%d", &reportid)
if err != nil || n != 1 {
//Return all Reports
var rl ReportList