Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add router package to group all routes
Signed-off-by: Luis Gustavo S. Barreto <gustavo@ossystems.com.br>
- Loading branch information
1 parent
7b477c5
commit c0468c0
Showing
7 changed files
with
45 additions
and
24 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package agentapi | ||
|
||
import ( | ||
"github.com/asdine/storm" | ||
"github.com/labstack/echo" | ||
) | ||
|
||
func SetupRoutes(e *echo.Group, db *storm.DB) { | ||
api := NewAgentAPI(db) | ||
|
||
e.POST(GetRolloutForDeviceUrl, api.GetRolloutForDevice) | ||
e.POST(ReportDeviceStateUrl, api.ReportDeviceState) | ||
e.GET(GetObjectFromPackageUrl, api.GetObjectFromPackage) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package webapi | ||
|
||
import ( | ||
"github.com/asdine/storm" | ||
"github.com/labstack/echo" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
func SetupRoutes(e *echo.Group, db *storm.DB) { | ||
devicesEndpoint := NewDevicesAPI(db) | ||
e.GET(GetAllDevicesUrl, devicesEndpoint.GetAllDevices) | ||
e.GET(GetDeviceUrl, devicesEndpoint.GetDevice) | ||
e.GET(GetDeviceRolloutReportsUrl, devicesEndpoint.GetDeviceRolloutReports) | ||
|
||
packagesEndpoint := NewPackagesAPI(db, viper.GetString("dir")) | ||
e.GET(GetAllPackagesUrl, packagesEndpoint.GetAllPackages) | ||
e.GET(GetPackageUrl, packagesEndpoint.GetPackage) | ||
e.POST(UploadPackageUrl, packagesEndpoint.UploadPackage) | ||
|
||
rolloutsEndpoint := NewRolloutsAPI(db) | ||
e.GET(GetAllRolloutsUrl, rolloutsEndpoint.GetAllRollouts) | ||
e.GET(GetRolloutUrl, rolloutsEndpoint.GetRollout) | ||
e.GET(GetRolloutStatisticsUrl, rolloutsEndpoint.GetRolloutStatistics) | ||
e.GET(GetRolloutDevicesUrl, rolloutsEndpoint.GetRolloutDevices) | ||
e.POST(CreateRolloutUrl, rolloutsEndpoint.CreateRollout) | ||
e.PUT(StopRolloutUrl, rolloutsEndpoint.StopRollout) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters