https://github.com/sinisaos/chi-ent
Example application using Ent ORM and Chi router.
https://github.com/sinisaos/chi-ent
chi entgo golang
Last synced: 3 months ago
JSON representation
Example application using Ent ORM and Chi router.
- Host: GitHub
- URL: https://github.com/sinisaos/chi-ent
- Owner: sinisaos
- License: mit
- Created: 2023-10-18T19:30:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-30T05:59:32.000Z (over 1 year ago)
- Last Synced: 2025-01-14T11:17:46.709Z (4 months ago)
- Topics: chi, entgo, golang
- Language: Go
- Homepage:
- Size: 243 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Example application using [Ent](https://entgo.io/). Library is easy to use and really powerful (especially ``FK`` and ``M2M ``relations) with code generation.
## How to use
Clone the repo.
```
$ git clone https://github.com/sinisaos/chi-ent.git
$ cd chi-ent
$ cp .env.example .env && rm .env.example # WARNING: change the DSN to your credentials and database name
$ make server
```## Generate the schema
To generate changes in the Ent schema.
```
$ make generate
```## Run tests
To run tests.
```
$ make tests
```After application is running you can visit ``localhost:8000/swagger/`` and use interactive Swagger documentation which was generated using [Entoas](https://github.com/ent/contrib/tree/master/entoas), with minor modifications to use authorization.
## Service layer
This application uses the [Chi](https://github.com/go-chi/chi) router, but since all database interaction is in the [service layer](https://github.com/sinisaos/chi-ent/tree/main/pkg/service), you can use any other router or framework for web part.