goaltools / goal

Goal is a toolkit for high productivity web development in Go language in the spirit of Revel Framework that is built around the concept of code generation.
BSD 2-Clause "Simplified" License
87 stars 3 forks source link

REST server skeleton #34

Closed davidhunterxyz closed 8 years ago

davidhunterxyz commented 8 years ago

@alkchr What do you think about a JSON REST server skeleton in Goal?

ghost commented 8 years ago

@DavidHunter I'm all for it. Are there any specific requirements (the way it should look like at al)?

davidhunterxyz commented 8 years ago

I think it should be similar to Tiger Tonic and follow guidelines from this blog post Best Practices for Designing a Pragmatic RESTful API. Swagger is also something interesting to look into.

ghost commented 8 years ago

@DavidHunter So what exactly Goal is missing right now?

  1. Reading of JSON from request body.
  2. Writing of JSON to the response.
  3. Better routing.
  4. Auto documentation of the API (easy to implement and useful).

Anything else? How do you see the implementation of these features? Any ideas?

P.S.: I haven't looked closely at swagger yet. Will do it.

davidhunterxyz commented 8 years ago

@alkchr I think the things you mentioned cover everything needed as a start. Then someone can create a new API server with

goal rest github.com/$username/$project
davidhunterxyz commented 8 years ago

@alkchr I think we should focus on getting the web server to production ready

ghost commented 8 years ago

@DavidHunter I'd like to discuss routing first. Currently, routes is a regular Go package. Advantages of this approach:

There are a few other approaches that could be applied:

@route('/hello/<name>')
def index(name):
    return template('<b>Hello {{name}}</b>!', name=name)

The last one is my favourite. Though there are no annotations in Go, that's why our version would look more like (not type safe):

// @GET /hello/:name
func (c App) Greet(name string) http.Handler {
    c.Context = name
    return c.Render()
}

What do you think? How the list of routes should look like (go package vs. conf file vs. "annotations")?

When we are done with routes we'll have to implement reverse routing.

I think we should focus on getting the web server to production ready

@DavidHunter You mean the production readiness of the API server? Any specific steps to achieve that? What should we pay attention to?

davidhunterxyz commented 8 years ago

@alkchr I mean production ready of github.com/colegion/goal/internal/skeleton Since their are plans to change organization name and etc.

ghost commented 8 years ago

Oh, I see.

ghost commented 8 years ago

Closing for now as there are no specific actionable items. Routing, auto documentation, etc. need their own issues.