-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.php
91 lines (84 loc) · 2.74 KB
/
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
$db = require __DIR__ . '/db.php';
return [
'id' => 'news-feed',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'modules' => [
'frontend' => [
'basePath' => '@app/modules/frontend',
'class' => 'app\modules\frontend\Module',
'layout' => '@app/modules/frontend/views/layouts/main',
],
'v1' => [
'basePath' => '@app/modules/v1',
'class' => 'app\modules\v1\Module'
]
],
'aliases' => [
'@api' => dirname(dirname(__DIR__)) . '/api',
'@frontend' => dirname(dirname(__DIR__)) . '/frontend',
],
'components' => [
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => false,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'urlManager' => [
'enablePrettyUrl' => true,
'enableStrictParsing' => true,
'showScriptName' => false,
'rules' => [
// frontend
'/' => 'frontend/main/index',
// api
[
'class' => \yii\rest\UrlRule::class,
'controller' => ['v1/article'],
'prefix' => 'api',
'tokens' => [
'{id}' => '<id:\\w+>'
],
'except' => ['delete', 'create', 'update']
],
[
'class' => \yii\rest\UrlRule::class,
'controller' => ['v1/category'],
'prefix' => 'api',
'tokens' => [
'{id}' => '<id:\\w+>'
],
'except' => ['delete', 'create', 'update']
]
],
],
'request' => [
'parsers' => [
'application/json' => 'yii\web\JsonParser',
'multipart/form-data' => 'yii\web\MultipartFormDataParser'
]
],
// 'response' => [
// 'formatters' => [
// \yii\web\Response::FORMAT_JSON => [
// 'class' => 'yii\web\JsonResponseFormatter',
// //'prettyPrint' => YII_DEBUG, // используем "pretty" в режиме отладки
// 'encodeOptions' => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE,
// ],
// ],
// ],
'db' => $db,
]
];