Created
August 28, 2018 20:38
-
-
Save JozefFlakus/d9b0468c261a272e1fc14e39558d8a32 to your computer and use it in GitHub Desktop.
Marble.js - sample controller example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getUsers$ = EffectFactory | |
| .matchPath('/') | |
| .matchType('GET') | |
| .use(req$ => req$.pipe( | |
| switchMap(Dao.getUsers), | |
| map(users => ({ body: users })), | |
| )); | |
| const postUser$ = EffectFactory | |
| .matchPath('/') | |
| .matchType('POST') | |
| .use(req$ => req$.pipe( | |
| map(req => req.body), | |
| switchMap(Dao.postUser), | |
| map(response => ({ body: response })), | |
| )); | |
| export const user$ = combineRoutes('/user', { | |
| middlewares: [authorize$], | |
| effects: [getUsers$, postUser$], | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment