https://github.com/grahms/worx
Worx is a framework for building APIs in Go with support for TMF (Telecom Management Forum) standards.
https://github.com/grahms/worx
framework godantic tmf
Last synced: 11 months ago
JSON representation
Worx is a framework for building APIs in Go with support for TMF (Telecom Management Forum) standards.
- Host: GitHub
- URL: https://github.com/grahms/worx
- Owner: GraHms
- Created: 2023-11-25T15:41:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-28T11:33:35.000Z (almost 2 years ago)
- Last Synced: 2024-04-28T12:35:16.097Z (almost 2 years ago)
- Topics: framework, godantic, tmf
- Language: Go
- Homepage:
- Size: 46.9 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Getting Started
Worx is a framework for building APIs in Go with support for TMF (Telecom Management Forum) standards. Follow these steps to get started:
### 1. Install Worx:
```bash
go get -u github.com/grahms/worx
```
### 2. Initialize Your Application:
Create a new Worx application:
```go
package main
import (
"github.com/grahms/worx"
"github.com/grahms/worx/router"
)
func main() {
app := worx.NewApplication("/api", "Product Catalog API")
}
```
### 3. Define Your API Endpoint:
Create a new API endpoint using the `NewRouter` function:
```go
product := worx.NewRouter[Product, ProductResponse](app, "/products")
```
### 4. Handle Requests:
Define your request handling logic using the `HandleCreate`, `HandleRead`, `HandleUpdate`, and `HandleList` methods:
```go
product.HandleCreate("", func(product Product, params *router.RequestParams) (*router.ProcessorError, *ProductResponse) {
return nil, &ProductResponse{
Product: product,
BaseType: nil,
Url: nil,
}
})
```
### 5. Run Your Application:
Start your Worx application and listen on a specified port:
```go
err := app.Run(":8080")
if err != nil {
panic(err)
}
```
Now, your Worx application is ready to handle TMF API requests.
---
Make sure to include the route before defining the handlers to ensure that the routes are properly registered in your application. Happy coding