Skip to content

Instantly share code, notes, and snippets.

@hanse
Created November 14, 2009 22:33
Show Gist options
  • Save hanse/234814 to your computer and use it in GitHub Desktop.
Save hanse/234814 to your computer and use it in GitHub Desktop.
<?php
post('/posts', function($params) {
// implementation code for post creation
});
put('/posts/(?P<id>\d+)', function($params) {
// write code to update a post
});
delete('/posts/(?P<id>\d+)', function($params) {
// write code to delete a post
});
get('/archives(/(?P<year>\d{2,4}))?(/(?P<month>\d{1,2}))?(/(?P<slug>[\w-]+))?', function($params) {
/*
Display an archive. year, month and slug are optional parameters
*/
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment