mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Example app structure. round 1.
This commit is contained in:
@@ -79,7 +79,8 @@ func FromRequest(appName, path string, req *http.Request) CallOpt {
|
||||
|
||||
baseVars["FN_FORMAT"] = route.Format
|
||||
baseVars["FN_APP_NAME"] = appName
|
||||
baseVars["FN_ROUTE"] = route.Path
|
||||
baseVars["FN_PATH"] = route.Path
|
||||
// TODO: might be a good idea to pass in: envVars["FN_BASE_PATH"] = fmt.Sprintf("/r/%s", appName) || "/" if using DNS entries per app
|
||||
baseVars["FN_MEMORY"] = fmt.Sprintf("%d", route.Memory)
|
||||
baseVars["FN_TYPE"] = route.Type
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
// any error that implements this interface will return an API response
|
||||
// APIError any error that implements this interface will return an API response
|
||||
// with the provided status code and error message body
|
||||
type APIError interface {
|
||||
Code() int
|
||||
@@ -170,7 +170,7 @@ func (e err) Code() int { return e.code }
|
||||
|
||||
func NewAPIError(code int, e error) APIError { return err{code, e} }
|
||||
|
||||
// uniform error output
|
||||
// Error uniform error output
|
||||
type Error struct {
|
||||
Error *ErrorBody `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user