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:02] – [Goravel] tungnt | development:goravel [2024/11/28 05:04] (current) – [Middleware] tungnt | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
https:// | https:// | ||
Line 84: | Line 84: | ||
~/ | ~/ | ||
+ | </ | ||
+ | |||
+ | ====== 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 ===== | ||
+ | |||
+ | < | ||
+ | server { | ||
+ | listen 80; | ||
+ | server_name goravel.example.com; | ||
+ | |||
+ | location / { | ||
+ | proxy_pass http:// | ||
+ | proxy_set_header Host $host; | ||
+ | proxy_set_header X-Real-IP $remote_addr; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | server { | ||
+ | listen | ||
+ | |||
+ | server_name goravel.example.com; | ||
+ | |||
+ | ssl_certificate | ||
+ | ssl_certificate_key / | ||
+ | |||
+ | ssl_session_timeout 5m; | ||
+ | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
+ | ssl_ciphers | ||
+ | ssl_prefer_server_ciphers on; | ||
+ | |||
+ | location / { | ||
+ | proxy_pass http:// | ||
+ | proxy_set_header Host $host; | ||
+ | proxy_set_header X-Real-IP $remote_addr; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | </ | ||
+ | |||
+ | ====== 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.1732705356.txt.gz · Last modified: 2024/11/27 11:02 by tungnt