router

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 8 Imported by: 0

README

SS Serverless Server

SS is a simple router for AWS Lambda function. This router allows us to use lambda function as server.

  • Allowed methods list.
  • Routing per methods .
  • Bing json objects from request and easy responses.
  • Best performance for lower cost.

Who Uses SS

How It Works

  1. As any other router (config, run, use).

Usage

First project

Use example project for faster deployment.

Install

Easy to install using AWS CLI. Just create user with necessary permissions and run shell script to install it in AWS.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

type Router struct {
	R        *models.LambdaRequest
	W        *models.LambdaResponse
	Ctx      context.Context
	RouteMap map[string]map[string]func(ctx context.Context, event models.LambdaRequest) (models.LambdaResponse, error)
}

func NewLambdaRouter

func NewLambdaRouter(ctx context.Context, event *models.LambdaRequest) (router Router)

func (Router) AllowedMethods

func (r Router) AllowedMethods(methods ...string) *Router

func (Router) BindJson

func (r Router) BindJson(d any) error

func (Router) Execute

func (r Router) Execute(name, path string, data any) (string, error)

func (Router) Handler

func (r Router) Handler(method, path string, f func(ctx context.Context, event models.LambdaRequest) (models.LambdaResponse, error))

func (Router) Middleware

func (r Router) Middleware() Router

func (Router) Run

func (r Router) Run() (models.LambdaResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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