githubjeka / yii2-rest

Yii2 REST API template
Other
159 stars 76 forks source link

Production Ready #5

Open masterbee opened 9 years ago

masterbee commented 9 years ago

Hi @githubjeka,

I am still learning Yii2 and was looking at this repo for a quick startup and way to implement quickly. I noticed that on the php init there was only the development option available. Just wondering if you consider this codebase stable enough for production environments?

githubjeka commented 9 years ago

Hi. You can get prod env from yii2-app-advanced/environments/prod/ Only you should add headers to rest index. See https://github.com/githubjeka/yii2-rest/blob/master/environments/dev/rest/web/index.php#L2

githubjeka commented 9 years ago

In fact

defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

to

defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

and need to add

header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS ');
header('Access-Control-Allow-Headers: Content-Type, Authorization');