Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AOP with FeathersJS
Search
AbraaoAlves
September 04, 2016
Programming
270
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
130
Other Decks in Programming
See All in Programming
SODA - FACT BOOK(EN)
sodainc
1
210
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
330
조합이폭발하는디자인시스템이걸눈으로도테스트하라고요
giljongyu
0
720
AI時代のFlutter品質設計 — アプリ品質を守るQuality Layers
omatty198
0
360
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
300
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
350
Distance field of Julia set
kinakomoti321
0
260
ChromeでローカルLLM
ryu1013
0
200
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
1.2k
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
520
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
330
AmebaブログはKMPから卒業します
kmars0605
0
330
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
5.2k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
600
Building an army of robots
kneath
307
47k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
610
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
660
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
570
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
320
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