How to use the @ui5/server.middlewareRepository.addMiddleware function in @ui5/server

To help you get started, we’ve selected a few @ui5/server 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 SAP / ui5-project / lib / projectPreprocessor.js View on Github external
handleServerMiddleware(extension) {
		if (!extension.metadata && !extension.metadata.name) {
			throw new Error(`Middleware extension ${extension.id} is missing 'metadata.name' configuration`);
		}
		if (!extension.middleware) {
			throw new Error(`Middleware extension ${extension.id} is missing 'middleware' configuration`);
		}
		const {middlewareRepository} = require("@ui5/server");

		const middlewarePath = path.join(extension.path, extension.middleware.path);
		middlewareRepository.addMiddleware(extension.metadata.name, middlewarePath);
	}
}

@ui5/server

UI5 Tooling - Server

Apache-2.0
Latest version published 2 months ago

Package Health Score

86 / 100
Full package analysis