Build golang microservices

WayScript allows you to configure your Lair to build an serverless API endpoint in minutes.

Install Dependencies

For HTTP trigger go functionality, this github repo needs to be added to your lair:

Create main.go

Use the boilerplate code below to create an main.go file in your Lair’s root directory. See File system for more details on how to manipulate files in your workspace file system.
Create a file called main.go

Boilerplate main.go

package main
import (
wayscript ""
func main() {
// Get payload for request event
event, err := wayscript.GetEvent()
if err != nil {
//Parse header and request body from request payload
// Create the data to send back to the HTTP trigger response
var jsonData = []byte(`
"data": "Hello World",
"headers": {"header":"value"},
"status_code": 200
triggerString, err := wayscript.SendHttpTriggerResponse(jsonData)
if err != nil {
} else {

Configure http trigger

Open your Lair’s Triggers Panel and add a new http trigger. Create a name for your trigger and input the following run command. See Triggers for more details.
go run main.go
Example HTTP Trigger Setup
Trigger Name - You can create any name you want for organization.
Command To Run - The Unix command to run your code.
Path - If you want multiple HTTP Triggers in the same lair, you can create custom URL paths. For example you can have <Endpoint_URL>/call-api and then another HTTP Trigger with the URL <Endpoint_URL>/do-something-else

Test your API in development environment

Navigate to the * endpoint generated by your http trigger to see your simple API in action!

Cloneable Template

For a cloneable HTTP trigger Golang template, please visit our public lair.

Deploy to production environment

Once you have finished testing, press “Deploy” to create a production environment for your API. Select <Lair_name>.prod in the Lair selector menu and view the http trigger to access your API’s production endpoint. See Hosted environments for more details.
By default, your Lair's endpoints are protected against unauthenticated requests. See Endpoints on how to public expose your endpoints or authenticate using your application key.
Last modified 2mo ago