What is Resoursea?

A high productivity web framework for quickly writing resource-based services fully implementing the REST architectural style.

This framework allows you to really focus on the Resources and how it behaves, and let the tool for routing the requests and inject the required dependencies.

This framework is written in Golang and uses the power of its implicit Interface and decentralized package manager.

Features

  • Describes the service API as a Go struct structure.
  • Method dependencies are constructed and injected when requested.
  • Resources becomes accessible simply defining the HTTP methods it is listening to.

Getting Started

First, install Go and setting up your GOPATH.

Install the Resoursea package:

go get github.com/resoursea/api

To create your service all you have to do is create ordinary Go structs and call the api .newRouter to route them for you. Then, just call the standard Go server to provide the resources on the network.

By Example

Save the code below in a file named main.go.

package main
import (
“log”
“net/http”
“github.com/resoursea/api”
)
type Gopher struct {
Message string
}
func (r *Gopher) GET() *Gopher {
return r
}
func main() {
router, err := api.NewRouter(Gopher{
Message: “Hello Gophers!”,
})
if err != nil {
log.Fatalln(err)
}
// Starting de HTTP server
log.Println(“Starting the service on http://localhost:8080/”)
if err := http.ListenAndServe(“:8080”, router); err != nil {
log.Fatalln(err)
}
}

Then run your new service:

go run main.go

Now you have a new REST service running, to GET your new Gopher Resource, open any browser and type http://localhost:8080/gopher.

Another more complete example shows how to build and test a simple library service with database access, dependency injection and the use of api.ID.

Lern More

Learn more in the GitHub API repository.

Router Printer

printer package was created just for debug reasons. If you want to see the tree of mapped routes and methods, you can import the https://github.com/resoursea/printer package and use the printer.Router method, passing the Router interface returned by a api.newRouter call.

Join The Community

About Resoursea

A high productivity web framework for quickly writing resource-based services fully implementing the REST architectural style.

This framework allows you to really focus on the Resources and how it behaves, and let the tool for routing the requests and inject the required dependencies.

This framework is written in Golang and uses the power of its implicit Interface and decentralized package manager.

To contribute to the project subscribe to our email list and access our repositories on GitHub.

Add us on Twitter to know what’s going on.

If you have any suggestions, please let us know.