forked from webdevwilson/graffiti
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
60 lines (41 loc) · 1.31 KB
/
README
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
What is it?
====================================================================================================
Graffiti is a lightweight web framework for Groovy inspired by Sinatra
Groovy Start:
====================================================================================================
import graffiti.*
// only required once
@Grab('com.goodercode:graffiti:1.0-SNAPSHOT')
@Get('/hello')
def hello() {
'Hello World!'
}
// /hello/name?name=You
@Get('/hello/name')
def helloWhomever() {
"Hello ${parameters[name]}"
}
// a sample post
@Post('/save')
def save() {
'saved it'
}
// static files served from here
Graffiti.root 'public'
// we also have to setup what static files to serve
Graffiti.serve '*.css'
// required to process annotations
Graffiti.serve this
Running It:
====================================================================================================
It's super easy!
groovy $YOUR_FILE_NAME.groovy
Implicit Variables:
====================================================================================================
application - ServletContext
parameters - map of parameters
request - HttpServletRequest
response - HttpServletResponse
session - HttpSession
That's all for now, not sure if or when I will add more features. Feel free to fork it and give it a go!
Cheers!