Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AOP with FeathersJS
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
AbraaoAlves
September 04, 2016
Programming
260
1
Share
AOP with FeathersJS
Show a powerful and flexible way to create API services in NodeJS.
AbraaoAlves
September 04, 2016
More Decks by AbraaoAlves
See All by AbraaoAlves
React+Redux+Typescript
abraaoalves
0
110
Other Decks in Programming
See All in Programming
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
360
Claude CodeでETLジョブ実行テストを自動化してみた
yoshikikasama
0
1.1k
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
120
Agentic Elixir
whatyouhide
0
430
How Swift's Type System Guides AI Agents
koher
0
320
t *testing.T は どこからやってくるの?
otakakot
1
870
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
430
JOAI2026 1st solution - heron0519 -
heron0519
0
170
🦞OpenClaw works with AWS
licux
1
320
Running Swift without an OS
kishikawakatsumi
0
870
【26新卒研修資料】TDD実装演習
dip_tech
PRO
0
150
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
130
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
3
350
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
160
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
4 Signs Your Business is Dying
shpigford
187
22k
Agile that works and the tools we love
rasmusluckow
331
21k
Building the Perfect Custom Keyboard
takai
2
740
Statistics for Hackers
jakevdp
799
230k
Site-Speed That Sticks
csswizardry
13
1.2k
Designing Powerful Visuals for Engaging Learning
tmiket
1
360
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
690
Java REST API Framework Comparison - PWX 2021
mraible
34
9.3k
Tell your own story through comics
letsgokoyo
1
910
Transcript
Aspect Oriented Programming with FeathersJS
Why Aspect?
Why Aspect ... var express = require('express'); var app =
express(); app.update('/', function (req, res, next) { if (isLoggedln(req) && isValidate(req)) { getUser(req.params.userId).then(function (user) { if (isAdmin(user) && isCurrent(user)) { updateInfo(req).then(function (info) { if (info.emailme) { sendEmail(user.email, info) } removePassword(user); res.send(info); }) } }); } }); because systems grow
@abraao4lves Software Engennier abraaoalves.github.io
Inspiration: Functional Programming f(g(x))
Continuation–passing style (CPS)
Continuation–passing style (CPS) let createUser = validateRequest >> verifyEmail >>
db.createUser >> smtpServer.sendEmail >> returnMessage F# Example:
(CPS) with NodeJS ?
var express = require('express'); var bodyParser = require('body-parser'); var app
= express(); app .use(bodyParser.json()) .use(function (req, res, next) { getUser(req.params.userId).then(function(user){ req.body.username = user.name; next() }) }) .use(function (req, res) { res.json(req.body || {message:'No content'}) }) (CPS) with NodeJS! Express - Middlewares
var express = require('express'); var bodyParser = require('body-parser'); var app
= express(); app .use(bodyParser.json()) .use(function (req, res, next) { getUser(req.params.userId).then(function(user){ req.body.username = user.name; next() }) }) .use(function (req, res) { res.json(req.body || {message:'No content'}) }) (CPS) with NodeJS! Express - Middlewares
And ... Aspect Oriented Programming?
Aspect Oriented Programming!
None
Get Starter
(CPS) with FeathersJS
(CPS) with FeathersJS // Register the hooks app.service('users') .before({ find:
[isLoggedIn, isAdmin], get: [isLoggedIn, isCurrent], create: hashPassword }) .after(removePasswords) .after({ create: sendEmail });
(CPS) with FeathersJS // Register the hooks app.service('users') .before({ find:
[isLoggedIn, isAdmin], get: [isLoggedIn, isCurrent], create: hashPassword }) .after(removePasswords) .after({ create: sendEmail });
(CPS) with FeathersJS // Register the hooks app.service('users') .before({ find:
[isLoggedIn, isAdmin], get: [isLoggedIn, isCurrent], create: hashPassword }) // To all methods .after(removePasswords) .after({ create: sendEmail });
DEMO
Thanks. @abraao4lves abraaoalves.github.io