This repository contains the code for my implementation of AWS Lambda written in Rust and GoLang.
- Next.js UI
- Remove need for docker ( Rust containers ??? ) Note: This project is currently in development and may be incomplete.
These instructions will help you set up the project on your local machine for development and testing purposes.
Make sure you have the following installed:
-
Clone the repository:
git clone https://github.com/seal/kappa.git
-
Change to the project directory:
cd kappa
api_key, err := client.CreateUser("http://localhost:3000", "username_here")
View /examples/server/* for an example
Then zip via:
zip -r my_folder.zip my_folder/*
container3, err := c.CreateContainer(client.ContainerOptions{
Name: "...namehere",
Language: "go", // Currently only go supported
Filepath: "filePath to .zip here",
})
Start the Postgres database using Docker Compose:
docker-compose up -d
Run the Rust code:
cargo run
The HTTP server will be created on port 3000.
Here's an example of how to implement the server:
//examples/server/main.go
func main() {
utils.Start(FuncName)
}
// HandleRequestContext returns an IO reader response
func FuncName(ctx context.Context) (io.Reader, error) {
// Code omitted
return strings.NewReader(body), nil
}
Possible parameter types are:
1:
func FuncName(ctx context.Context) (string, error){
values := ctx.Value(utils.ContextKey).(utils.ContextValues)
/*
type ContextValues struct {
ID string `json:"id"`
Headers http.Header `json:"headers"`
}
*/
}
2:
func FuncName(ctx context.Context, event MyEvent) (Response, error) {
return Response{MessageOne: event.Message, MessageTwo: event.MessageTwo}, nil
}
type Response struct {
MessageOne string `json:"messageOne"`
MessageTwo string `json:"messagewTwo"`
}
type MyEvent struct {
Message string `json:"message"`
MessageTwo string `json:"messageTwo"`
}
Structs can be customized to the users need etc
Run the /examples/client/main.go for examples
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.