forked from plainblack/Wing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
78 lines (47 loc) · 2.46 KB
/
README.txt
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
Wing is a modern web services platform written in Perl. It allows you to define objects and then automatically generates database schemas, restful web services, and even web form handlers to manage those objects. It's got built in users, sessions, single-sign-on and more.
INSTALLATION
1. Clone this repository into /data/Wing on your machine:
mkdir /data
cd /data
git clone [email protected]:plainblack/Wing.git
2. Install the prereqs.
cd /data/Wing/bin/setup
./01_download.sh
./02_build.sh
./03_install_perl_modules.sh
. /data/Wing/bin/dataapps.sh
3. Create a project:
cd /data/Wing/bin
export WING_HOME=/data/Wing
perl wing_init_app.pl --app=MyApp
4. Create a database on your MySQL server to host the project, and edit the Wing config to match:
mysql -uroot -p -e "create database my_project"
mysql -uroot -p -e "grant all privileges on my_project.* to some_user@localhost identified by 'some_pass'"
mysql -uroot -p -e "flush privileges"
vi /data/MyApp/etc/wing.conf
# edit the "db" section and add the username and password.
5. Initialize the database:
cd /data/MyProject/bin
export WING_HOME=/data/Wing
export WING_APP=/data/MyApp/
export WING_CONFIG=/data/MyApp/etc/wing.conf
perl $WING_HOME/bin/wing_db.pl --install --ok
6. Start up the rest server and/or web server:
cd /data/MyApp/bin
./start_rest.sh
./start_web.sh
7. Now you can connect to the rest server and see if it's alive:
curl http://localhost:5000/api/status
curl http://localhost:5001/account
NOTE: By default there is one user named 'Admin' with a password of '123qwe'.
8. We also provide you with an nginx config file to give you a baseline for serving your apps. You can start it like this:
nginx -c /data/MyApp/etc/nginx.conf
ADDING FUNCTIONALITY
We also provide you with tools to build out your app. For example, if you want to add a new class to your app, you can:
wing_add_class.pl --class=NewObject
This will dynamically generate a NewObject.pm class file for you in /data/MyApp/lib/MyApp/DB/Result/, and create a Rest
interface at /data/MyApp/lib/MyApp/Rest/NewObject.pm, and create a Web interface at /data/MyApp/lib/MyApp/Web/NewObject.pm.
It will even add the lines needed in /data/MyApp/bin/rest.psgi and /data/MyApp/bin/web.psgi.
Once you've built out your object and you're ready to generate some web templates for it you can do:
wing_template_class.pl --class=NewObject
That will add templates in /data/MyApp/views/newobject/*.tt.