Last active
December 4, 2017 23:02
-
-
Save belohlavek/ec488b96435893ea2b0a671f9f0d8daf to your computer and use it in GitHub Desktop.
Testo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"message": "Hello world!" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun render(request) = { | |
html: { | |
body: { | |
(Header::render(request.queryParams.name default 'User')) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun render(name: String) = { | |
h1 @(style: 'color: red'): "Hello $(name)" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%dw 2.0 | |
fun toJSON(a) = a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * from dw::http::Server | |
fun renderHtml(x) = write(x, 'text/xml', {writeDeclaration: false}) | |
--- | |
api({ | |
host: "0.0.0.0", | |
port: 8080 | |
}, { | |
"/": { | |
GET: (request) -> { | |
body: renderHtml(App::render(request)), | |
headers: { | |
'Content-Type': 'text/html' | |
} | |
} | |
}, | |
"/test": { | |
GET: (req) -> body: req, | |
POST: (req) -> body: req | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%dw 2.0 | |
output application/json | |
--- | |
{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"project": { | |
"name": "Testo", | |
"mainScript": "scripts/main.dwl", | |
"apiled": { | |
"deploymentId": "17bb9236-670c-4cec-93e8-4f83fafdf42f", | |
"domain": "testo" | |
} | |
}, | |
"meta": { | |
"projectFileVersion": "0.1.0", | |
"creationDate": "12/04/2017" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment