Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementar HTTP GET/plants #5

Closed
mdelapenya opened this issue Sep 7, 2019 · 6 comments · Fixed by #8
Closed

Implementar HTTP GET/plants #5

mdelapenya opened this issue Sep 7, 2019 · 6 comments · Fixed by #8
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Projects

Comments

@mdelapenya
Copy link
Member

Este endpoint retornará todas las plantas existentes en el almacenamiento primario, en este caso Elasticsearch

@mdelapenya mdelapenya added enhancement New feature or request good first issue Good for newcomers labels Sep 7, 2019
@mdelapenya mdelapenya self-assigned this Sep 7, 2019
@mdelapenya
Copy link
Member Author

Voy a comenzar con esta tarea: voy a crear una PR con la implementación en Go utilizando un framework web como Gin-Gonic o Gobuffalo

@mdelapenya
Copy link
Member Author

Tras leer https://www.slant.co/versus/4797/20918/~gin-gonic_vs_buffalo, voy a tirar por Gin-Gonic

mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
It returns a 204 (NoContent) at this moment
@javierlopezdeancos
Copy link
Member

Voy a leereme ese artículo, me encanta empezar a implementar en Go

@javierlopezdeancos
Copy link
Member

Exactamente podrías indicarnos aquí después de tu lectura y tu experiencia como backend porque, a tu criterio, es mejor Gin-gonic? he leído el artículo y tengo mis ideas pero quisiera contrastarlas con alguien con mas experiencia en go y en API.

@javierlopezdeancos javierlopezdeancos added this to To do in The Garden Sep 7, 2019
@javierlopezdeancos javierlopezdeancos moved this from To do to In progress in The Garden Sep 7, 2019
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
- Logrus will allow building structured logs
- Elasticsearch client will allow communicating with a elasticsearch cluster
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
The query will be a map[string]interface{}, which is the only way
to do it using the client
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
It will look for the ES cluster, so that's why we use hostnames instead of localhost
mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 7, 2019
- make build
- make start
- make seed
- make destroy
@mdelapenya
Copy link
Member Author

mdelapenya commented Sep 8, 2019

Pues me gusta más Gin-gonic porque parece más simple para implementar un API, sin necesitar un interfaz gráfico de usuario atado al framework, como hace GoBuffalo. Éste último proporciona todo lo necesario para montar el API y además proporciona un sistema de templates para poder crear las vistas. Por tanto es más pesado en cuanto a dependencias.

Desde mi punto de vista, nuestro scaffolding, donde GoBuffalo también tiene su generator, es tan simple en este momento que no necesita justamente esto: un generador de código boilerplate.

Otra cosa es lo que pasará en un futuro, pero a día de hoy es simple.

Otro tema que me parece importante es el no-acoplamiento con ningún framework de vistas (assets pipeline lo llaman, ¿no?). Con GoBuffalo supongo puedes poner su framework (por simplicidad) o poner otro, y con Gin-Gonic metes lo que te dé la gana, básicamente.

De todas maneras, si queremos usar su framework, hay que aprender un montón de patrones de diseño, y si no lo queremos usar, nos comemos todas las dependencias, por lo que el peso del binario aumentará de manera considerable.

No obstante, podemos hacer una POC

mdelapenya added a commit to mdelapenya/linneo that referenced this issue Sep 8, 2019
@mdelapenya
Copy link
Member Author

mdelapenya commented Sep 9, 2019

Otro motivo de preferencia: Gin tiene integración con el APM Agent de Go de Elastic, así que sería posible meter trazas a la aplicación https://www.elastic.co/guide/en/apm/agent/go/current/supported-tech.html
https://www.elastic.co/guide/en/apm/agent/go/current/instrumenting-source.html#builtin-modules-apmgin

SideNote: y me gusta que rime con botellín

The Garden automation moved this from In progress to Done Sep 9, 2019
mdelapenya added a commit that referenced this issue Sep 9, 2019
@mdelapenya mdelapenya mentioned this issue Sep 9, 2019
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
The Garden
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants