*
*
- * @module server/middleware/discovery
+ * @module @ui5/server/middleware/discovery
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files
- * @param {AbstractReader} resourceCollections.source Resource reader or collection for the source project
- * @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
- * @returns {function} Returns a server middleware closure.
+ * @param {module:@ui5/fs.AbstractReader} resourceCollections.source Resource reader or collection for the source project
+ * @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
+ * @returns {Function} Returns a server middleware closure.
*/
function createMiddleware({resourceCollections}) {
return function discoveryMiddleware(req, res, next) {
diff --git a/lib/middleware/nonReadRequests.js b/lib/middleware/nonReadRequests.js
index 5da2d797..f6fc685f 100644
--- a/lib/middleware/nonReadRequests.js
+++ b/lib/middleware/nonReadRequests.js
@@ -4,8 +4,8 @@
* Handles non read requests (POST, PUT, DELETE...) and returns an error 404,
* because those operations aren't supported by the server.
*
- * @module server/middleware/nonReadRequests
- * @returns {function} Returns a server middleware closure.
+ * @module @ui5/server/middleware/nonReadRequests
+ * @returns {Function} Returns a server middleware closure.
*/
function createMiddleware() {
return function nonReadRequests(req, res, next) {
diff --git a/lib/middleware/serveIndex.js b/lib/middleware/serveIndex.js
index 8ed9b017..d246f38b 100644
--- a/lib/middleware/serveIndex.js
+++ b/lib/middleware/serveIndex.js
@@ -10,8 +10,8 @@ const GB = KB * KB * KB;
/**
* Returns the mime type of the given resource
*
- * @param {Resource} resource the resource
- * @returns {String} mime type
+ * @param {module:@ui5/fs.Resource} resource the resource
+ * @returns {string} mime type
*/
function getMimeType(resource) {
if (rProperties.test(resource.getPath())) {
@@ -24,8 +24,8 @@ function getMimeType(resource) {
/**
* Converts the given bytes into a proper human readable size
*
- * @param {Number} bytes bytes
- * @returns {String} human readable size
+ * @param {number} bytes bytes
+ * @returns {string} human readable size
*/
function formatSize(bytes) {
let result;
@@ -45,7 +45,7 @@ function formatSize(bytes) {
* Creates a resource info object which is used to create the HTML
* content for the resource listing
*
- * @param {Resource} resource the resource to convert
+ * @param {module:@ui5/fs.Resource} resource the resource to convert
* @returns {Object} resource info object
*/
function createResourceInfo(resource) {
@@ -69,7 +69,7 @@ function createResourceInfo(resource) {
/**
* Creates a resource info array from the given resource array
*
- * @param {Resource[]} resources an array of resources
+ * @param {module:@ui5/fs.Resource[]} resources an array of resources
* @returns {Object[]} sorted array of resource infos
*/
function createResourceInfos(resources) {
@@ -90,9 +90,9 @@ function createResourceInfos(resources) {
/**
* Creates the HTML content for the resource listing
*
- * @param {String} path the path
+ * @param {string} path the path
* @param {Object[]} resourceInfos an array of resource infos
- * @returns {String} HTML content for the resource listing
+ * @returns {string} HTML content for the resource listing
*/
function createContent(path, resourceInfos) {
return `
@@ -131,10 +131,10 @@ function createContent(path, resourceInfos) {
/**
* Creates and returns the middleware to serve a resource index.
*
- * @module server/middleware/serveIndex
+ * @module @ui5/server/middleware/serveIndex
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files
- * @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
- * @returns {function} Returns a server middleware closure.
+ * @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
+ * @returns {Function} Returns a server middleware closure.
*/
function createMiddleware({resourceCollections}) {
return function serveIndex(req, res, next) {
diff --git a/lib/middleware/serveResources.js b/lib/middleware/serveResources.js
index d80010c6..a4a436ef 100644
--- a/lib/middleware/serveResources.js
+++ b/lib/middleware/serveResources.js
@@ -17,10 +17,10 @@ function isFresh(req, res) {
/**
* Creates and returns the middleware to serve application resources.
*
- * @module server/middleware/serveResources
+ * @module @ui5/server/middleware/serveResources
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files
- * @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
- * @returns {function} Returns a server middleware closure.
+ * @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
+ * @returns {Function} Returns a server middleware closure.
*/
function createMiddleware({resourceCollections}) {
return function serveResources(req, res, next) {
diff --git a/lib/middleware/serveThemes.js b/lib/middleware/serveThemes.js
index 4da17d10..cd4094a4 100644
--- a/lib/middleware/serveThemes.js
+++ b/lib/middleware/serveThemes.js
@@ -16,10 +16,10 @@ const themeRequest = /^(.*\/)library(?:(\.css)|(-RTL\.css)|(-parameters\.json))$
*
* The theme is built in realtime. If a less file was modified, the theme build is triggered to rebuild the theme.
*
- * @module server/middleware/serveThemes
+ * @module @ui5/server/middleware/serveThemes
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files
- * @param {AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
- * @returns {function} Returns a server middleware closure.
+ * @param {module:@ui5/fs.AbstractReader} resourceCollections.combo Resource collection which contains the workspace and the project dependencies
+ * @returns {Function} Returns a server middleware closure.
*/
function createMiddleware({resourceCollections}) {
const builder = new themeBuilder.ThemeBuilder({
diff --git a/lib/middleware/versionInfo.js b/lib/middleware/versionInfo.js
index c9e30687..23e97d9c 100644
--- a/lib/middleware/versionInfo.js
+++ b/lib/middleware/versionInfo.js
@@ -3,10 +3,10 @@ const createVersionInfoProcessor = require("@ui5/builder").processors.versionInf
/**
* Creates and returns the middleware to create the version info as json object.
*
- * @module server/middleware/versionInfo
+ * @module @ui5/server/middleware/versionInfo
* @param {Object} resourceCollections Contains the resource reader or collection to access project related files
- * @param {AbstractReader} resourceCollections.dependencies Resource collection which contains the project dependencies
- * @returns {function} Returns a server middleware closure.
+ * @param {module:@ui5/fs.AbstractReader} resourceCollections.dependencies Resource collection which contains the project dependencies
+ * @returns {Function} Returns a server middleware closure.
*/
function createMiddleware({resourceCollections, tree: project}) {
return function versionInfo(req, res, next) {
diff --git a/lib/server.js b/lib/server.js
index 4f87a227..39cd320c 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -15,104 +15,6 @@ const ui5Fs = require("@ui5/fs");
const resourceFactory = ui5Fs.resourceFactory;
const ReaderCollectionPrioritized = ui5Fs.ReaderCollectionPrioritized;
-/**
- * Start a server for the given project (sub-)tree
- *
- * @module server/server
- * @param {Object} tree A (sub-)tree
- * @param {Object} options Options
- * @param {number} options.port Port to listen to
- * @param {boolean} [options.changePortIfInUse=false] If true, change the port if it is already in use
- * @param {boolean} [options.h2=false] Whether HTTP/2 should be used - defaults to http
- * @param {string} [options.key] Path to private key to be used for https
- * @param {string} [options.cert] Path to certificate to be used for for https
- * @param {boolean} [options.acceptRemoteConnections=false] If true, listens to remote connections and not only to localhost connections
- * @returns {Promise