api

package
v0.0.0-...-4a8ccef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2025 License: MIT Imports: 7 Imported by: 0

README

github.com/sdslabs/gasper/lib/api

This package consists of methods that have a direct affect on the user requests. Some guidelines that need to be followed:

  • For every exportable function, use the type ResponseError as in package .../gasper/lib/types.

    // The NewResponseError function takes 3 arguments
    // Status Code: int
    // Message: string -> Any customized message for the error
    // Error: error -> If any error is thrown and response message is the same
    
    // When message is customized
    err := types.NewResponseError(400, "Invalid user input", nil)
    
    // When message is same as someother error message
    err1 := someErrorThrowingFunc()
    err2 := types.NewResponseError(500, "", err1)
    

    * Customized error messages are required as many times sensitive information is revealed while sending the response back

    This will be further used as follows:

    func controllerFunc(c *gin.Context) {
        // Some code here
        // If an error is generated
        c.JSON(err.Status(), gin.H{
            "error": err.Reason(),
        })
    }
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBasicApplication

func CreateBasicApplication(app types.Application) []types.ResponseError

createBasicApplication spawns a new container with the application of a particular service

func RunBuildAndStartCommands

func RunBuildAndStartCommands(app types.Application) types.ResponseError

func SetupApplication

func SetupApplication(app types.Application) types.ResponseError

SetupApplication sets up a basic container for the application with all the prerequisites

func StopAllProcesses

func StopAllProcesses(app types.Application) types.ResponseError

func UpdateApplication

func UpdateApplication(app types.Application) types.ResponseError

func UpdateContainer

func UpdateContainer(app types.Application) types.ResponseError

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL