Three Approaches for Organizing your AdonisJS Business Logic Operations

In this lesson, we'll dive deep into three different ways we can organize our code; fat controllers, services, and actions. We'll also discuss circular dependencies, static and non-static service methods, and dependency injection.

Published
Jul 22
Duration
28m 8s

Developer, dog lover, and burrito eater. Currently teaching AdonisJS, a fully featured NodeJS framework, and running Adocasts where I post new lessons weekly. Professionally, I work with JavaScript, .Net C#, and SQL Server.

Adocasts

Burlington, KY

🕰️ Chapters
00:00 - Objectives & Project Familiarity
01:02 - What Are Fat Controllers?
02:43 - Fat Controllers & Services with Static Methods
04:08 - Completing Our Fat Controller Store Method
06:28 - Testing Our Store Method
07:50 - Fat Controller Pros/Cons
08:34 - Switching To Services
08:49 - Non-Static Service Methods
09:52 - Services & Dependency Injection (DI)
11:30 - The Service Approach
14:20 - Completing Our Service Store Method
16:20 - Splitting Out Sub-Tasks with Services
17:08 - Testing Our Service Store Method
17:23 - Service Approach Pros/Cons
17:53 - Services & Circular Dependencies
20:15 - Switching To Actions
20:30 - What Is An Action?
21:55 - The Action Approach
23:34 - Completing Our Action Store Class
24:42 - Splitting Out Sub-Tasks with Actions
25:55 - Testing Our Action Store Class
26:48 - Action Approach Pros/Cons
27:17 - Wrapping Up & Other Potential Options

Join The Discussion! (0 Comments)

Please sign in or sign up for free to join in on the dicussion.

robot comment bubble

Be the first to Comment!