MCPcopy Index your code
hub / github.com/aliuygur/gores

github.com/aliuygur/gores @1.2.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.2.2 ↗ · + Follow
31 symbols 68 edges 2 files 18 documented · 58% updated 5y agov1.2.2 · 2021-01-01★ 106
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

gores

Build Status GoDoc Go Report Card

http response utility library for Go

this package is very small and lightweight, useful for RESTful APIs.

installation

go get github.com/alioygur/gores

usage

package main

import (
    "log"
    "net/http"

    "github.com/alioygur/gores"
)

type User struct {
    Name  string
    Email string
    Age   int
}

func main() {
    // Plain text response
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        gores.String(w, http.StatusOK, "Hello World")
    })

    // HTML response
    http.HandleFunc("/html", func(w http.ResponseWriter, r *http.Request) {
        gores.HTML(w, http.StatusOK, "<h1>Hello World</h1>")
    })

    // JSON response
    http.HandleFunc("/json", func(w http.ResponseWriter, r *http.Request) {
        user := User{Name: "Ali", Email: "ali@example.com", Age: 28}
        gores.JSON(w, http.StatusOK, user)
    })

    // File response
    http.HandleFunc("/file", func(w http.ResponseWriter, r *http.Request) {
        err := gores.File(w, r, "./path/to/file.html")

        if err != nil {
            log.Println(err.Error())
        }
    })

    // Download file
    http.HandleFunc("/download-file", func(w http.ResponseWriter, r *http.Request) {
        err := gores.Download(w, r, "./path/to/file.pdf", "example.pdf")

        if err != nil {
            log.Println(err.Error())
        }
    })

    // No content
    http.HandleFunc("/no-content", func(w http.ResponseWriter, r *http.Request) {
        gores.NoContent(w)
    })

    // Error response
    http.HandleFunc("/error", func(w http.ResponseWriter, r *http.Request) {
        gores.Error(w, http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError))
    })

    err := http.ListenAndServe(":8000", nil)
    if err != nil {
        log.Fatal("ListenAndServe: ", err)
    }
}

for more documentation godoc

Contribute

Use issues for everything

  • Report problems
  • Discuss before sending a pull request
  • Suggest new features/recipes
  • Improve/fix documentation

Thanks & Authors

I use code/got inspiration from these excellent libraries:

Core symbols most depended-on inside this repo

JSON
called by 2
gores.go
JSONIndent
called by 2
gores.go
_json
called by 2
gores.go
JSONP
called by 2
gores.go
XML
called by 2
gores.go
XMLIndent
called by 2
gores.go
_xml
called by 2
gores.go
file
called by 2
gores.go

Shape

Function 30
Struct 1

Languages

Go100%

Modules by API surface

gores.go21 symbols
gores_test.go10 symbols

For agents

$ claude mcp add gores \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact