What's Changed
* [BREAKING] Renamed Guards decorator to UseGuards decorator by eadwinCode in https://github.com/eadwinCode/ellar/pull/93
New Features
* Background Task Feature by eadwinCode in https://github.com/eadwinCode/ellar/pull/91
You can inject BackgroundTasks instance to you route handler
python
async def send_welcome_email(email):
print(f'Send Welcome Email Task Called with "{email}"')
router.post('/signup')
def sign_up(username: str, password: str, email: str, tasks: BackgroundTasks):
tasks.add_task(send_welcome_email, email=email)
return {'status': 'Signup successful'}
* EllarInterceptors by eadwinCode in https://github.com/eadwinCode/ellar/pull/92
Use of interceptors to add more custom implementation to your route handlers and controller as define by [Aspect Oriented Programming](https://en.wikipedia.org/wiki/Aspect-oriented_programming) (AOP) technique
python
injectable
class ResponseModifierInterceptor(EllarInterceptor):
async def intercept(
self, context: IExecutionContext, next_interceptor: t.Callable[..., t.Coroutine]
) -> t.Any:
data = await next_interceptor()
if data:
data.update(ResponseModifierInterceptor="ResponseModifierInterceptor modified returned resulted")
return data
Controller("")
class InterceptorControllerTest(ControllerBase):
UseInterceptors(ResponseModifierInterceptor)
get("/interceptor-1")
async def interceptor_1(self):
return {"message": "intercepted okay"}
**Full Changelog**: https://github.com/eadwinCode/ellar/compare/0.3.8...0.4.0