-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35786f1
commit 29fd154
Showing
52 changed files
with
1,152 additions
and
1,909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,7 @@ | |
config.json | ||
|
||
.idea/ | ||
.vscode/ | ||
.vscode/ | ||
|
||
.storage/avatars/* | ||
!.storage/avatars/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,89 +1,24 @@ | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/System-Glitch/goyave/master/resources/img/logo/goyave_text.png" alt="Goyave Logo" width="550"/> | ||
<img src="https://raw.githubusercontent.com/go-goyave/goyave/master/resources/img/logo/goyave_text.png#gh-light-mode-only" alt="Goyave Logo" width="550"/> | ||
<img src="https://raw.githubusercontent.com/go-goyave/goyave/master/resources/img/logo/goyave_text_dark.png#gh-dark-mode-only" alt="Goyave Logo" width="550"/> | ||
</p> | ||
|
||
## Goyave Blog Example | ||
|
||
![https://github.com/go-goyave/goyave-blog-example/actions](https://github.com/go-goyave/goyave-blog-example/workflows/Test/badge.svg) | ||
|
||
This codebase was created to demonstrate a fully fledged fullstack application built with **[Goyave](https://github.com/System-Glitch/goyave)** including CRUD operations, authentication, routing, pagination, and more. | ||
This example project was created to demonstrate a simple application built with **[Goyave](https://github.com/go-goyave/goyave)** including CRUD operations, authentication, routing, pagination, and more. With this application, users can register, login and write blog posts (articles) or read the other user's ones. | ||
|
||
## Getting Started | ||
## Running the project | ||
|
||
### Requirements | ||
First, make your own configuration for your local environment. | ||
|
||
- Go 1.16+ | ||
- Go modules | ||
- Copy `config.example.json` to `config.json`. | ||
- Start the database container with `docker-compose up`. | ||
- Run migrations with [dbmate](https://github.com/amacneil/dbmate): `dbmate -u postgres://dbuser:[email protected]:5432/blog?sslmode=disable -d ./database/migrations --no-dump-schema migrate` | ||
- Run `go run main.go` in your project's directory to start the server. If you want to seed your database with random records use the `-seed` flag: `go run main.go -seed`. Users will all be created with the following password: `p4ssW0rd_` | ||
|
||
### Directory structure | ||
## Resources | ||
|
||
``` | ||
. | ||
├── database | ||
│ ├── model // ORM models | ||
│ | └── ... | ||
│ └── seeder // Generators for database testing | ||
│ └── ... | ||
├── http | ||
│ ├── controller // Business logic of the application | ||
│ │ └── ... | ||
│ ├── middleware // Logic executed before or after controllers | ||
│ │ └── ... | ||
│ ├── validation | ||
│ │ └── validation.go // Custom validation rules | ||
│ └── route | ||
│ └── route.go // Routes definition | ||
│ | ||
├── resources | ||
│ └── lang | ||
│ └── en-US // Overrides to the default language lines | ||
│ ├── fields.json | ||
│ ├── locale.json | ||
│ └── rules.json | ||
│ | ||
├── test // Functional tests | ||
| └── ... | ||
| | ||
├── .gitignore | ||
├── .golangci.yml // Settings for the Golangci-lint linter | ||
├── config.example.json // Example config for local development | ||
├── config.test.json // Config file used for tests | ||
├── go.mod | ||
└── main.go // Application entrypoint | ||
``` | ||
|
||
### Running the project | ||
|
||
First, make your own configuration for your local environment. You can copy `config.example.json` to `config.json`. | ||
|
||
Run `go run main.go` in your project's directory to start the server. | ||
|
||
**Using docker:** | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
|
||
**Run tests with docker:** | ||
|
||
``` | ||
docker-compose -f docker-compose.test.yml up --abort-on-container-exit | ||
``` | ||
|
||
**Database seeding:** | ||
|
||
If `app.environment` is set to `localhost` in the config and if the database is empty (no record in the users table), the seeders will be executed and a random dataset will be generated and inserted into the database. | ||
|
||
## Learning Goyave | ||
|
||
The Goyave framework has an extensive documentation covering in-depth subjects and teaching you how to run a project using Goyave from setup to deployment. | ||
|
||
<a href="https://goyave.dev/guide/installation"><h3 align="center">Read the documentation</h3></a> | ||
|
||
<a href="https://pkg.go.dev/goyave.dev/goyave/v4"><h3 align="center">pkg.go.dev</h3></a> | ||
|
||
## License | ||
|
||
This example project is MIT Licensed. Copyright © 2020 Jérémy LAMBERT (SystemGlitch) | ||
|
||
The Goyave framework is MIT Licensed. Copyright © 2019 Jérémy LAMBERT (SystemGlitch) | ||
- [Documentation](https://goyave.dev) | ||
- [go.pkg.dev](https://pkg.go.dev/goyave.dev/goyave/v5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,54 @@ | ||
{ | ||
"app": { | ||
"name": "goyave-blog-example", | ||
"environment": "test", | ||
"debug": false, | ||
"defaultLanguage": "en-US", | ||
"bcryptCost": 10 | ||
"name": "goyave.dev/template", | ||
"environment": "localhost", | ||
"debug": true, | ||
"defaultLanguage": "en-US" | ||
}, | ||
"server": { | ||
"host": "127.0.0.1", | ||
"maintenance": false, | ||
"protocol": "http", | ||
"domain": "", | ||
"port": 8080, | ||
"httpsPort": 443, | ||
"timeout": 10, | ||
"maxUploadSize": 10 | ||
"port": 0, | ||
"writeTimeout": 10, | ||
"readTimeout": 10, | ||
"readHeaderTimeout": 10, | ||
"idleTimeout": 20, | ||
"websocketCloseTimeout": 10, | ||
"maxUploadSize": 10.0, | ||
"proxy": { | ||
"protocol": "http", | ||
"host": "", | ||
"port": 80, | ||
"base": "" | ||
} | ||
}, | ||
"database": { | ||
"connection": "mysql", | ||
"host": "${DB_HOST}", | ||
"port": 3306, | ||
"name": "goyave", | ||
"username": "goyave", | ||
"password": "secret", | ||
"options": "charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=true&loc=Local", | ||
"connection": "none", | ||
"host": "127.0.0.1", | ||
"port": 0, | ||
"name": "", | ||
"username": "", | ||
"password": "", | ||
"options": "", | ||
"maxOpenConnections": 20, | ||
"maxIdleConnections": 20, | ||
"maxLifetime": 300, | ||
"autoMigrate": true | ||
"defaultReadQueryTimeout": 20000, | ||
"defaultWriteQueryTimeout": 40000, | ||
"config": { | ||
"skipDefaultTransaction": false, | ||
"dryRun": false, | ||
"prepareStmt": true, | ||
"disableNestedTransaction": false, | ||
"allowGlobalUpdate": false, | ||
"disableAutomaticPing": true, | ||
"disableForeignKeyConstraintWhenMigrating": false | ||
} | ||
}, | ||
"auth": { | ||
"jwt": { | ||
"expiry": 3600, | ||
"secret": "1C4C304DACBEC13CC975A3708CFAF6AED0A478573C1C0D7EBFF0E7E8530C06B7" | ||
"secret": "jwt-secret", | ||
"expiry": 3000 | ||
} | ||
} | ||
} |
Oops, something went wrong.