Toy Note

A demo Golang API project

Jacob Xie published on
1 min, 156 words

Categories: Post

Intro

For convenience sake, as a full-stack developer I've been working with NodeJS for a long while. Using NodeJS as backend service obviously gives coders a lot of flexibility, such as mature open-source libraries, same frontend & backend language, etc. However, in some cases, for example in a concurrency scenario, NodeJS is no more feasible. After a short time of survey, Golang turns out to be an alternative option for me to build up my backend service. And here I wrote a simple toy project to record my study progress. Check the full source code on Github.

Structure

The project structure is simple enough to understand:

toy-note
    ├── api
    │   ├── controller
    │   │   ├── note.go
    │   │   ├── query.go
    │   │   └── response.go
    |   |
    │   ├── entity
    │   │   ├── affiliate.entity.go
    │   │   ├── post.entity.go
    │   │   ├── tag.entity.go
    │   │   └── common.go
    |   |
    │   ├── persistence
    │   │   ├── mongo_test.go
    │   │   ├── mongo.go
    │   │   ├── postgres_test.go
    │   │   └── postgres.go
    |   |
    │   ├── service
    │   │   ├── note.service_test.go
    │   │   ├── note.service.go
    │   │   └── repository.go
    |   |
    │   ├── util
    │   │   ├── config_test.go
    │   │   └── config.go
    |   |
    │   └── api.go
    |
    ├── cmd
    │   └── app
    │       └── main.go
    |
    ├── docs
    │   ├── docs.go
    │   ├── swagger.json
    │   └── swagger.yaml
    |
    ├── env
    │   ├── dev.env
    │   └── prod.env
    |
    ├── logger
    │   └── logger.go
    |
    ├── go.mod
    ├── go.sum
    └── Makefile

to be continued...