How to use the moleculer-web.serveStatic 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 icebob / kantab / backend / mixins / openapi.mixin.js View on Github external
created() {
			const route = _.defaultsDeep(mixinOptions.routeOptions, {
				use: [
					ApiGateway.serveStatic(SwaggerUI.absolutePath())
				],

				aliases: {

					"GET /openapi.json"(req, res) {
						// Send back the generated schema
						if (shouldUpdateSchema || !schema) {
							// Create new server & regenerate GraphQL schema
							this.logger.info("♻ Regenerate OpenAPI/Swagger schema...");

							try {
								schema = this.generateOpenAPISchema();

								shouldUpdateSchema = false;

								this.logger.debug(schema);
github icebob / kantab / backend / services / api.service.js View on Github external
/**
			 * Static routes
			 */
			{
				path: "/",

				use: [
					// handle fallback for HTML5 history API
					require("connect-history-api-fallback")(),

					// Webpack middlewares
					...initWebpackMiddlewares(),

					// Serve static
					ApiGateway.serveStatic("./static"),
				],

				// Action aliases
				aliases: {
				},

				mappingPolicy: "restrict",
			},
		]
	},

	methods: {
		/**
		 * Authenticate from request
		 *
		 * @param {Context} ctx

moleculer-web

Official API Gateway service for Moleculer framework

MIT
Latest version published 6 months ago

Package Health Score

80 / 100
Full package analysis