This second day is a quick one. After reviewing the different options to bootstrap an API in Golang, I’ve decided to go with Buffalo as a framework.
While you can definitely get a project like randomdata.dev running out of the standard libs, I needed some guidance on file organization and best practices around go. Buffalo also includes the following useful features:
- Dev mode
- ORM with pop/soda
- Middlewares and Actions
As I wanted to be able to have the data layer (base attributes values used to fake an entity), available everywhere and fast, I’ve decided to setup a test Docker CockroachDB cluster.
After populating a thousand values for my first User entity attributes (
Lastname), I realized this was over-engineered and a bit slow.
As a matter of fact, the data used to generate the entities will be
read-only by the API. So what would be the best way to provide this data to my app ?
I quickly refactored this to use a SQLite database. Access was quicker and this reduces my overall complexity. Plus, the SQLite data can be directly shipped inside my production container making them self-contained.
See the next article: 3 out of #100DaysOfCode - Storing the data