Prepare Laravel API for Railway
This commit is contained in:
12
.env.example
12
.env.example
@@ -9,6 +9,7 @@ LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
DATABASE_URL=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
@@ -57,3 +58,14 @@ JWT_ISSUER=
|
||||
JWT_AUDIENCE=
|
||||
JWT_PUBLIC_KEY_PEM=
|
||||
JWT_TOKEN=
|
||||
|
||||
# Railway production example:
|
||||
# APP_ENV=production
|
||||
# APP_DEBUG=false
|
||||
# APP_URL=https://your-service.up.railway.app
|
||||
# LOG_CHANNEL=stderr
|
||||
# DB_CONNECTION=pgsql
|
||||
# DATABASE_URL=${{Postgres.DATABASE_URL}}
|
||||
# CACHE_DRIVER=file
|
||||
# SESSION_DRIVER=file
|
||||
# QUEUE_CONNECTION=sync
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"ext-mbstring": "*",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^10.10",
|
||||
"laravel/sanctum": "^3.3",
|
||||
|
||||
5
composer.lock
generated
5
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "dfdbaa9a791903e1a015e16cbcf49f3b",
|
||||
"content-hash": "f080935717fcb1c63a43fa5940618db0",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@@ -8540,7 +8540,8 @@
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^8.1"
|
||||
"php": "^8.1",
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.9.0"
|
||||
|
||||
13
railway.json
Normal file
13
railway.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "https://railway.com/railway.schema.json",
|
||||
"build": {
|
||||
"builder": "RAILPACK"
|
||||
},
|
||||
"deploy": {
|
||||
"preDeployCommand": "php artisan migrate --force",
|
||||
"healthcheckPath": "/api/health",
|
||||
"healthcheckTimeout": 100,
|
||||
"restartPolicyType": "ON_FAILURE",
|
||||
"restartPolicyMaxRetries": 10
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,14 @@ Route::prefix('v1')->middleware(['jwt.auth'])->group(function () {
|
||||
|
||||
// Jogos
|
||||
Route::get('/games/most-played', [GameController::class, 'mostPlayed']);
|
||||
});
|
||||
|
||||
Route::get('/health', function () {
|
||||
return response()->json(['status' => 'ok']);
|
||||
});
|
||||
|
||||
Route::middleware(['jwt.auth'])->get('/test-auth', function (Request $request) {
|
||||
return response()->json([
|
||||
'userId' => $request->attributes->get('auth')['id']
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user