/
app.psgi
executable file
·51 lines (38 loc) · 1016 Bytes
/
app.psgi
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
use common::sense;
use Raisin::API;
# setting app home dir
use Cwd qw/realpath/;
use FindBin ();
BEGIN { unshift @INC, "$FindBin::Bin/lib" }
BEGIN { $ENV{RAISIN_HOME} = realpath("$FindBin::Bin/../../") }
## logger plugin
plugin 'Logger', fallback => 1;
app->log(debug => 'Starting Raisin application...');
## cors plugin
middleware 'CrossOrigin',
origins => '*',
methods => [qw/DELETE GET HEAD OPTIONS PATCH POST PUT/],
headers => [qw/accept authorization content-type api_key_token/];
## swagger plugin
plugin 'Swagger';
swagger_setup(
# project title
title => 'Eokoe Raisin',
description => 'Eokoe Raisin application example',
# project contact
contact => {
name => 'Daniel Vinciguerra',
url => 'http://github.com/eokoe',
email => 'daniel@eokoe.com',
},
# project license
license => {
name => 'Perl license',
url => 'http://dev.perl.org/licenses/'
}
);
# set api format
api_format 'json';
# mount user endpoints
mount 'App::Controller::User';
run;