development:goravel
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
development:goravel [2024/11/27 11:12] – [air] tungnt | development:goravel [2024/11/28 05:04] (current) – [Middleware] tungnt | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
https:// | https:// | ||
Line 87: | Line 87: | ||
====== Build web server ====== | ====== Build web server ====== | ||
+ | |||
+ | ===== supervisor ===== | ||
+ | |||
+ | < | ||
+ | [program: | ||
+ | process_name=%(program_name)s_%(process_num)02d | ||
+ | ; | ||
+ | command=/ | ||
+ | directory=/ | ||
+ | autostart=true | ||
+ | autorestart=true | ||
+ | user=tungnt | ||
+ | redirect_stderr=true | ||
+ | stdout_logfile=/ | ||
+ | stopwaitsecs=3600 | ||
+ | </ | ||
+ | |||
+ | ===== nginx config ===== | ||
< | < | ||
Line 120: | Line 138: | ||
} | } | ||
+ | </ | ||
+ | |||
+ | ====== The Basic ====== | ||
+ | |||
+ | ===== Controllers ===== | ||
+ | |||
+ | < | ||
+ | go run . artisan make: | ||
+ | |||
+ | go run . artisan make: | ||
+ | </ | ||
+ | |||
+ | ===== Middleware ===== | ||
+ | |||
+ | <code go> | ||
+ | go run . artisan make: | ||
+ | </ | ||
+ | |||
+ | <file go app/ | ||
+ | package http | ||
+ | |||
+ | import ( | ||
+ | " | ||
+ | |||
+ | " | ||
+ | ) | ||
+ | |||
+ | type Kernel struct { | ||
+ | } | ||
+ | |||
+ | // The application' | ||
+ | // These middleware are run during every request to your application. | ||
+ | func (kernel Kernel) Middleware() []http.Middleware { | ||
+ | return []http.Middleware{ | ||
+ | middleware.ApiAuth(), | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <file go routes/ | ||
+ | import " | ||
+ | |||
+ | facades.Route().Middleware(middleware.Auth()).Get(" | ||
+ | </ | ||
+ | |||
+ | ===== Request ===== | ||
+ | |||
+ | < | ||
+ | go run . artisan make: | ||
+ | </ | ||
+ | |||
+ | ===== Rule ===== | ||
+ | |||
+ | < | ||
+ | go run . artisan make:rule Uppercase | ||
</ | </ |
development/goravel.1732705926.txt.gz · Last modified: 2024/11/27 11:12 by tungnt