Last active
August 29, 2015 14:01
-
-
Save aaronpowell/7df5e1fd1a7967259d38 to your computer and use it in GitHub Desktop.
Express DLS
This file contains 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
let get = macro { | |
rule { $path:lit $do $res:lit } => { | |
app.get($path, function (req, res) { | |
res.$do($res); | |
}); | |
} | |
rule { $path:lit $do:ident($sc:lit) $res:lit } => { | |
app.get($path, function (req, res) { | |
res.$do($res); | |
res.status($sc); | |
}); | |
} | |
rule { $path:lit with ($req:ident $res:ident) { $body ... } } => { | |
app.get($path, function ($req, $res) { | |
$body ... | |
}); | |
} | |
} | |
get '/' with (req res) { | |
req.send('Hello'); | |
} | |
get '/404' render(404) 'not-found' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment