Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { getCommentByArticleEffect$ } from './effects/get-comment-by-article.effect';
import { postCommentByArticleEffect$ } from './effects/post-comment-by-article.effect';
const getCommentByArticle$ = EffectFactory.matchPath('/')
.matchType('GET')
.use(getCommentByArticleEffect$);
const postCommentByArticle$ = EffectFactory.matchPath('/')
.matchType('POST')
.use(postCommentByArticleEffect$);
// const removeCommentByArticle$ = EffectFactory.matchPath("/:commentId")
// .matchType("DELETE")
// .use(removeCommentEffect$);
export const comment$ = combineRoutes('/article/:articleId/comment', {
effects: [getCommentByArticle$, postCommentByArticle$],
});
import { combineRoutes, EffectFactory } from '@marblejs/core';
import { authorize$ } from '../auth/middlewares/auth.middleware';
import { getMovieEffect$ } from './effects/getMovie.effect';
import { getMovieListEffect$ } from './effects/getMovieList.effect';
const getMovieList$ = EffectFactory
.matchPath('/')
.matchType('GET')
.use(getMovieListEffect$);
const getMovie$ = EffectFactory
.matchPath('/:id')
.matchType('GET')
.use(getMovieEffect$);
export const movies$ = combineRoutes('/movies', {
effects: [getMovieList$, getMovie$],
middlewares: [authorize$],
});
import { combineRoutes, EffectFactory } from '@marblejs/core';
import { getUserListEffect$ } from './effects/getUserList.effect';
import { getMeEffect$ } from './effects/getMe.effect';
import { authorize$ } from '../auth/middlewares/auth.middleware';
export const getUserList$ = EffectFactory
.matchPath('/')
.matchType('GET')
.use(getUserListEffect$);
export const getMe$ = EffectFactory
.matchPath('/me')
.matchType('GET')
.use(getMeEffect$);
export const users$ = combineRoutes('/users', {
effects: [getUserList$, getMe$],
middlewares: [authorize$],
});
import { combineRoutes, EffectFactory } from '@marblejs/core';
import { loginEffect$ } from './effects/login.effect';
const login$ = EffectFactory
.matchPath('/login')
.matchType('POST')
.use(loginEffect$);
export const auth$ = combineRoutes('/auth', [login$]);
.matchType('DELETE')
.use(removeArticleEffect$);
const updateArticle$ = EffectFactory.matchPath('/:id')
.matchType('PUT')
.use(updateArticleEffect$);
const updateArticleReaction$ = EffectFactory.matchPath('/:id/reaction')
.matchType('POST')
.use(updateArticleReactionEffect$);
const postArticle$ = EffectFactory.matchPath('/')
.matchType('POST')
.use(postArticleEffect$);
export const article$ = combineRoutes('/article', {
effects: [getArticleList$, getArticleById$, getArticleBySlug$, updateArticleReaction$],
});
export const authorizedArticle$ = combineRoutes('/article', {
effects: [postArticle$, removeArticle$, updateArticle$],
middlewares: [authorize$],
});
export const authorizedDraft$ = combineRoutes('/draft', {
effects: [getDraftList$],
middlewares: [authorize$],
});
r.matchPath('/ws'),
r.matchType('GET'),
r.useEffect(req$ => req$.pipe(
switchToProtocol('websocket')
)));
const notFound$ = r.pipe(
r.matchPath('*'),
r.matchType('*'),
r.useEffect(req$ => req$.pipe(
mergeMap(() => throwError(
new HttpError('Route not found', HttpStatus.NOT_FOUND)
)),
)));
export const api$ = combineRoutes(
'/api/:version',
[ root$, user$, static$, notImplemented$, webSockets$, notFound$ ],
);
import { combineRoutes, EffectFactory } from '@marblejs/core';
import { authorize$ } from '../auth/middlewares/auth.middleware';
import { getActorListEffect$ } from './effects/getActorList.effect';
import { getActorEffect$ } from './effects/getActor.effect';
const getActorList$ = EffectFactory
.matchPath('/')
.matchType('GET')
.use(getActorListEffect$);
const getActor$ = EffectFactory
.matchPath('/:id')
.matchType('GET')
.use(getActorEffect$);
export const actors$ = combineRoutes('/actors', {
effects: [getActorList$, getActor$],
middlewares: [authorize$],
});
const preflight$ = EffectFactory
.matchPath('*')
.matchType('OPTIONS')
.use(preflightEffect$);
const getFile$ = EffectFactory
.matchPath('/assets/:dir*')
.matchType('GET')
.use(getFileEffect$);
const notFound$ = EffectFactory
.matchPath('*')
.matchType('*')
.use(notFoundEffect$);
export const api$ = combineRoutes('/api/v1', [
root$,
auth$,
users$,
actors$,
movies$,
getFile$,
preflight$,
notFound$
]);
import { combineRoutes, EffectFactory } from "@marblejs/core";
import { loginEffect$ } from "./effects/login.effect";
import { signupEffect$ } from "./effects/signup.effect";
const login$ = EffectFactory.matchPath("/login")
.matchType("POST")
.use(loginEffect$);
const signup$ = EffectFactory.matchPath("/signup")
.matchType("POST")
.use(signupEffect$);
export const authentication$ = combineRoutes("/auth", [login$, signup$]);
.matchPath('/')
.matchType('GET')
.use(req$ => req$.pipe(
mapTo({ body: `API version: v1` }),
));
const notFound$ = EffectFactory
.matchPath('*')
.matchType('*')
.use(req$ => req$.pipe(
switchMap(() =>
throwError(new HttpError('Route not found', HttpStatus.NOT_FOUND))
)
));
export const api$ = combineRoutes(
'/api/v1',
[ root$, auth$, user$, notFound$ ],
);