All Projects → alioygur → Gores

alioygur / Gores

Licence: apache-2.0
Go package that handles HTML, JSON, XML and etc. responses

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Gores

Dashboard Server
A JSON file RESTful API with authorization based on json-server
Stars: ✭ 48 (-48.94%)
Mutual labels:  rest-api, restful, json-api
Server
Serve your Rubix ML models in production with scalable stand-alone model inference servers.
Stars: ✭ 30 (-68.09%)
Mutual labels:  rest-api, json-api
Bootstrapi
A better framework for building API with PHP. Built using Slim 3, Eloquent, Zend-ACL
Stars: ✭ 86 (-8.51%)
Mutual labels:  restful, json-api
Calm
It is always Calm before a Tornado!
Stars: ✭ 50 (-46.81%)
Mutual labels:  rest-api, restful
Core
Pluf is an open source PHP framework, which is very light and fast.
Stars: ✭ 6 (-93.62%)
Mutual labels:  rest-api, restful
Farwest
Framework for building RESTful HATEOAS-driven applications.
Stars: ✭ 18 (-80.85%)
Mutual labels:  rest-api, restful
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-47.87%)
Mutual labels:  rest-api, restful
Koa2 Api Scaffold
一个基于Koa2的轻量级RESTful API Server脚手架。
Stars: ✭ 694 (+638.3%)
Mutual labels:  rest-api, restful
Api Strategy
Equinor API Strategy
Stars: ✭ 56 (-40.43%)
Mutual labels:  rest-api, restful
Tigo
Tigo is an HTTP web framework written in Go (Golang).It features a Tornado-like API with better performance. Tigo是一款用Go语言开发的web应用框架,API特性类似于Tornado并且拥有比Tornado更好的性能。
Stars: ✭ 1,130 (+1102.13%)
Mutual labels:  rest-api, restful
Videosniffer
视频嗅探服务(VideoSniffer API Service On Android)
Stars: ✭ 68 (-27.66%)
Mutual labels:  restful, json-api
Gen
Converts a database into gorm structs and RESTful api
Stars: ✭ 825 (+777.66%)
Mutual labels:  rest-api, restful
Ngx Restangular
Restangular for Angular 2 and higher versions
Stars: ✭ 787 (+737.23%)
Mutual labels:  rest-api, restful
Tns Restful Json Api
This is the code repository that goes along with the "TheNewStack" article for RESTful JSON API post
Stars: ✭ 846 (+800%)
Mutual labels:  restful, json-api
Apidoc
RESTful API 文档生成工具,支持 Go、Java、Swift、JavaScript、Rust、PHP、Python、Typescript、Kotlin 和 Ruby 等大部分语言。
Stars: ✭ 785 (+735.11%)
Mutual labels:  rest-api, restful
Restfm
RESTful web services for FileMaker server.
Stars: ✭ 76 (-19.15%)
Mutual labels:  rest-api, restful
Rest Api Design Guide
NBB's REST-ish API Design Guide
Stars: ✭ 643 (+584.04%)
Mutual labels:  rest-api, restful
Ulfius
Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
Stars: ✭ 666 (+608.51%)
Mutual labels:  rest-api, restful
Json Api Dart
JSON:API client for Dart/Flutter
Stars: ✭ 53 (-43.62%)
Mutual labels:  rest-api, json-api
Graceful
Elegant Python REST toolkit built on top of falcon
Stars: ✭ 73 (-22.34%)
Mutual labels:  rest-api, restful

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

requirements

gores library requires Go version >=1.7

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: "[email protected]", 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:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].