by optymizer1 · 12y ago · 0 comments
type HelloResource struct {
sleepy.Resource
}
This makes it clear that you're inheriting everything from sleepy.Resource, so you can provide reasonable implementations for all methods of resources, not just HTTP methods handlers, e.g. getBodyAsJSON(), redirect(resource), etc.Also, depending on how your mux works, you could store app-level data in sleepy.Resource, to be accessed by all resources:
sleepy.Resource.DB
sleepy.Resource.Session
sleepy.Resource.Root
and other things I can't think of right now.No comments yet.