fromfluxionalimportFluxional,WsEvent,LambdaContext,Websocketflux=Fluxional("Backend")@flux.websocket.on_connectdefconnect(event:WsEvent,context:LambdaContext):return{"statusCode":200}@flux.websocket.on("some_action")defon_action(event:WsEvent,context:LambdaContext):# Reply to the senderWebsocket.post_to_connection(event,"Hello World!")handler=flux.handler()
fromfluxionalimportFluxional,StorageEvent,LambdaContextflux=Fluxional("Backend")@flux.storage.on_uploaddefon_upload(event:StorageEvent,context:LambdaContext):# Do something when a file is uploadedhandler=flux.handler()
fromfluxionalimportFluxional,LambdaContext,Eventflux=Fluxional("Backend")event=Event[str]()@flux.eventdefon_event(payload:str,context:LambdaContext):# Do something when an event is triggereddeftrigger_event():# Trigger on_event with str payloadevent.trigger("on_event","Hello World!")handler=flux.handler()
fromfluxionalimportFluxional,TaskEvent,LambdaContextflux=Fluxional("Backend")@flux.run.every(1,"days")deftask_1(event:TaskEvent,context:LambdaContext):# Do something every day from nowhandler=flux.handler()
2) Deploy without installing and managing Node, Aws Cli & CDK versions
Fluxional provides a containarized deployment flow. No need to install and Manage versions of Node, AWS Cli or CDK on your machine ⛔.
Provide your credentials in a .env and you are good to go 😊.
Your AWS Lambda functions are containerized and dockerfiles are auto-generated 😎 based on the runtime, requirements and dependencies you need.
To deploy 🚀 your application:
$fluxionaldeployapp.handler
To remove 🔨 your application:
$fluxionaldestroyapp.handler
3) Live Development- Interact with your microservice as you code
Invoke your microservice locally 💻 and make live changes 🕘 without the need to mock your services or re-deploy.
Your code will be ran in a local container with the exact ✨ environment and behaviors your application will have in the cloud.
** Setting must be enabled and deployed before executing below.