How to use the moleculer-web.ForbiddenError function in moleculer-web

To help you get started, we’ve selected a few moleculer-web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gothinkster / moleculer-node-realworld-example-app / services / articles.service.js View on Github external
.then(entity => {
						if (!entity)
							return this.Promise.reject(new MoleculerClientError("Article not found!", 404));

						if (entity.author !== ctx.meta.user._id)
							return this.Promise.reject(new ForbiddenError());

						return this.adapter.removeById(entity._id)
							.then(() => ctx.call("favorites.removeByArticle", { article: entity._id }));
					});
			}
github gothinkster / moleculer-node-realworld-example-app / services / comments.service.js View on Github external
.then(comment => {
						if (comment.author !== ctx.meta.user._id)
							return this.Promise.reject(new ForbiddenError());

						return this.adapter.removeById(ctx.params.id);
					});	
			}

moleculer-web

Official API Gateway service for Moleculer framework

MIT
Latest version published 6 months ago

Package Health Score

80 / 100
Full package analysis