go-sdk

command module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

README

Nitric Logo

Nitric SDK for Go

test status

Client libarary for interfacing with the Nitric APIs as well as the creation of golang functions with Nitric.

Quick Start

Using the Nitric CLI
  1. Get the Nitric CLI
  2. Create a new Nitric Project nitric make:project <my-new-project>
  3. Select function/golang15 as a starter function

Using the Nitric SDK

Creating a new API client
import "github.com/nitrictech/go-sdk/api"

// NitricFunction - Handles individual function requests (http, events, etc.)
func createNitricClient() {
  client, err := api.New()

  if err != nil {
    // Do something with err
  }
}
Starting a Nitric FaaS server
package main

import "github.com/nitrictech/go-sdk/faas"

// NitricFunction - Handles individual function requests (http, events, etc.)
func NitricFunction(request *faas.NitricRequest) *faas.NitricResponse {
	// Do something interesting...
	return &faas.NitricResponse{
		Status: 200,
		Body:   []byte("Hello Nitric"),
	}
}

func main() {
	faas.Start(NitricFunction)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
interfaces

Jump to

Keyboard shortcuts

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