Allow compilation of the API on Windows

This commit is contained in:
Nyo
2016-06-22 13:13:33 +02:00
parent 7cbbb626c1
commit 244186cf4e
6 changed files with 155 additions and 60 deletions

View File

@@ -1,3 +1,5 @@
// +build !windows
package v1
import (

42
app/v1/meta_windows.go Normal file
View File

@@ -0,0 +1,42 @@
// +build windows
package v1
import (
"time"
"git.zxq.co/ripple/rippleapi/common"
)
// MetaRestartGET restarts the API with Zero Downtime™.
func MetaRestartGET(md common.MethodData) common.CodeMessager {
return common.SimpleResponse(200, "brb in your dreams")
}
// MetaKillGET kills the API process. NOTE TO EVERYONE: NEVER. EVER. USE IN PROD.
// Mainly created because I couldn't bother to fire up a terminal, do htop and kill the API each time.
func MetaKillGET(md common.MethodData) common.CodeMessager {
return common.SimpleResponse(200, "haha")
}
var upSince = time.Now()
type metaUpSinceResponse struct {
common.ResponseBase
Code int `json:"code"`
Since int64 `json:"since"`
}
// MetaUpSinceGET retrieves the moment the API application was started.
// Mainly used to get if the API was restarted.
func MetaUpSinceGET(md common.MethodData) common.CodeMessager {
return metaUpSinceResponse{
Code: 200,
Since: int64(upSince.UnixNano()),
}
}
// MetaUpdateGET updates the API to the latest version, and restarts it.
func MetaUpdateGET(md common.MethodData) common.CodeMessager {
return common.SimpleResponse(200, "lol u wish")
}