Golang and Angular 2, Why not?

David Nguyen
2 min readApr 13, 2017

I am not a guru with Go and Angular 2, But to be curious, I just want to combine them to make a simple app. This app will write some text to a picture like using photoshop to create a card.

Our plan is create an api that take text then using this package https://github.com/fogleman/gg to load a font and picture then write that text to the picture with loaded font. To make api we will use gin https://github.com/gin-gonic/gin

Firstly we will define model that we will work

Then create api to generate a card from text like this

Next we will build front end for app using angular 2. We will create two main components. One for display a form for user input text then send them to api we’ve created above

and one for display card that generated from api.

An important part is how to make angular 2 app can interact with our above api. Let use service

Finally serve angular 2 from gin

Enjoy our results

Hope it helpful, Thanks for reading and happy to received your feedbacks. Try with full code at https://github.com/thanhngvpt/chucnhau

--

--