Skip to content

Simplou/goxios

Repository files navigation

Goxios

GoReport

Goxios is an HTTP client written in Go, inspired by Axios

Introduction:

Goxios is a powerful HTTP client library for Go developers, heavily inspired by the renowned Axios library in JavaScript. It aims to simplify the process of making HTTP requests in Go, offering a clean and intuitive API while focusing on performance and memory efficiency.

Key Features:

  • Axios-inspired API: Goxios provides an API that will feel familiar to developers who have experience with Axios, making it easy to transition between JavaScript and Go projects.

  • Fast Development: By abstracting away low-level details and providing a high-level interface, Goxios accelerates development, allowing you to focus on building your application logic without getting bogged down by HTTP client intricacies.

Getting Started:

To start using Goxios in your project, simply import it and begin making requests:

package main

import (
	"context"
	"fmt"
	"io"

	"github.com/Simplou/goxios"
)

func main() {
    // Create a new Goxios client
    client := goxios.New(context.Background())

    // Make a GET request
    requestOpts := &goxios.RequestOpts{Headers: []goxios.Header{}}
    resp, err := client.Get("https://api.sampleapis.com/codingresources/codingResources", requestOpts)
    if err != nil {
       panic(err)
    }
    defer resp.Body.Close()
    // Save the response body bytes in 'b'
    b, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }
    fmt.Println(string(b)) // Print the content of 'b' as a string
}

For more advanced usage and customization options, refer to the documentation on GoDoc. .

License:

Goxios is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements:

Special thanks to the developers of Axios for their inspiration.

Maintainer:

Gabriel Luiz - @gabrielluizdev