Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dqfan2012/learngin
This is me learning the gin web framework and giving it my own mini "Laravel" twist.
https://github.com/dqfan2012/learngin
Last synced: about 1 month ago
JSON representation
This is me learning the gin web framework and giving it my own mini "Laravel" twist.
- Host: GitHub
- URL: https://github.com/dqfan2012/learngin
- Owner: dqfan2012
- Created: 2024-06-04T03:37:07.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-04T06:26:24.000Z (7 months ago)
- Last Synced: 2024-06-19T03:12:14.157Z (7 months ago)
- Language: Go
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Learning Gin
This is my journey into learning the gin web framework and giving it my own mini "Laravel" twist.
## Translating Laravel Commands
I use the `Makefile` to attempt to replicate Laravel console commands.
### Database Migrations
**Running Migrations**
`Laravel`
```bash
php artisan migrate
````Mine`
```bash
make migrate-up
```**Rolling Migrations Back**
`Laravel`
```bash
php artisan migrate:rollback
````Mine`
```bash
make migrate-down
```### Creating Models
`Laravel`
```bash
php artisan make:model
````Mine`
My model creation isn't nearly as robust as Laravel's model creation.
```bash
make model
```### Seeding the Database
`Laravel`
```bash
php artisan db:seed
````Mine`
```bash
make seed
```### Getting a basic development build going
**Running the basic server**
```bash
make server
```You can make sure the server is running using the following command:
```bash
curl http://localhost:8080/status
```The response should be:
```bash
{
"status": "ok"
}
```Be sure to pipe into `jq` to pretty print JSON to the console.
**A little more robust**
This will tear down all previous migrations. Run fresh migrations. Seed the database. Start the server.
```bash
make setup-dev
```If you use the basic user model provided in this repository, you can see the first "dummy" user here:
```bash
curl http://localhost:8080/user | jq
```You'll get an output similar to the following:
```bash
{
"id": 1,
"first_name": "Hillary",
"last_name": "Kutch",
"email": "[email protected]",
"password": "password",
"role": "publisher",
"remember_token": "VLxRVIaSbF",
"created_at_utc": "2024-06-04T03:30:15.648846Z",
"updated_at_utc": "2024-06-04T03:30:15.648846Z",
"created_at_local": "2024-06-03T23:30:15.648846-04:00",
"updated_at_local": "2024-06-03T23:30:15.648846-04:00",
"email_verified_at": null
}
```## Database
This currently features migrations for Postgresql.
## Contributors
I am not accepting contributions to this repo at this time.