Skip to content

Instantly share code, notes, and snippets.

@grimrose
Last active November 8, 2015 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grimrose/33d91e2a2e84a2d9ae0f to your computer and use it in GitHub Desktop.
Save grimrose/33d91e2a2e84a2d9ae0f to your computer and use it in GitHub Desktop.
@Grab("ninja.siden:siden-core:+")
import ninja.siden.App
import groovy.json.JsonBuilder
Object.metaClass.asJson = {
def builder = new JsonBuilder(delegate)
builder.toString()
}
def map = [:]
map['foo'] = 'ハローワールド'
map['bar'] = [1, 2, 3]
map['boo'] = ['hoge' : 'aaa', 'fuga' : [1, 2, ['obj':true]]]
def app = new App()
app.get("/map", { req, res -> map.asJson() })
app.listen()
@grimrose
Copy link
Author

grimrose commented Nov 8, 2015

$ groovy siden.groovy

if you need speed at start.

# require groovyserv
$ groovyclient siden.groovy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment