Parcourir la source

Added docker auto doc build

rigwild il y a 4 ans
Parent
commit
6c3079c515

+ 1 - 1
back.Dockerfile

@@ -8,7 +8,7 @@ WORKDIR /usr/src/app
 # Server port
 EXPOSE 5000
 
-RUN yarn install
+RUN yarn install && yarn doc
 
 # Build front if SERVE_CLIENT=true
 CMD if [ "$SERVE_CLIENT" == "true" ] ; then NODE_ENV=test yarn test && yarn run app:build && yarn run server:start ; else NODE_ENV=test yarn test && yarn run server:start ; fi

+ 10 - 10
server/index.js

@@ -32,16 +32,16 @@ app.use(imageServedUrl, serveStatic(imagesPath))
 // Load all the API routes in the server
 app.use(apiPrefix, routes)
 
-if (serveClient) {
-  // Serve client files (Client is local)
-  app.use('/', express.static(path.resolve(__dirname, '../dist')))
-}
-else {
-  // Don't serve client files (Client is remote)
-  // Turn "Cross-origin resource sharing" on to allow the remote client to connect to the API
-  app.use(cors())
-  app.get('*', (req, res) => res.status(404).send('Client is not served.'))
-}
+// Serve documentation
+app.use('/doc', express.static(path.resolve(__dirname, '../doc')))
+
+// Serve client files
+if (serveClient) app.use('/', express.static(path.resolve(__dirname, '../dist')))
+else app.get('*', (req, res) => res.status(404).send('Client is not served.'))
+
+
+// Turn "Cross-origin resource sharing" on to allow remote clients to connect to the API
+app.use(cors())
 
 // Error handler (Middleware called when throwing in another middleware)
 app.use(errorHandler)

+ 1 - 1
server/routes/getImage.js

@@ -23,7 +23,7 @@ const router = express.Router()
  * @apiHeader (Response Headers) {String} Content-Type application/json; charset=utf-8
  *
  * @apiExample Usage example
- * curl -i -L -X GET "http://localhost:5000/api/getImage?sceneName=bathroom&imageQuality=200"
+ * curl -i -L -X GET "http://diran.univ-littoral.fr/api/getImage?sceneName=bathroom&imageQuality=200"
  *
  * @apiSuccess {String} data Path to the image
  * @apiSuccessExample {json} Success response example

+ 1 - 1
server/routes/getImageExtracts.js

@@ -28,7 +28,7 @@ const router = express.Router()
  * @apiHeader (Response Headers) {String} Content-Type application/json; charset=utf-8
  *
  * @apiExample Usage example
- * curl -i -L -X GET "http://localhost:5000/api/getImageExtracts?sceneName=bathroom&imageQuality=200&horizontalExtractCount=1&verticalExtractCount=2"
+ * curl -i -L -X GET "http://diran.univ-littoral.fr/api/getImageExtracts?sceneName=bathroom&imageQuality=200&horizontalExtractCount=1&verticalExtractCount=2"
  *
  * @apiSuccess {String[]} data Path to the extracted images
  * @apiSuccessExample {json} Success response example

+ 1 - 1
server/routes/listSceneQualities.js

@@ -18,7 +18,7 @@ const router = express.Router()
  * @apiHeader (Response Headers) {String} Content-Type application/json; charset=utf-8
  *
  * @apiExample Usage example
- * curl -i -L -X GET "http://localhost:5000/api/listSceneQualities?sceneName=bathroom"
+ * curl -i -L -X GET "http://diran.univ-littoral.fr/api/listSceneQualities?sceneName=bathroom"
  *
  * @apiSuccess {Number[]} data List of available qualities
  * @apiSuccessExample {json} Success response example

+ 1 - 1
server/routes/listScenes.js

@@ -21,7 +21,7 @@ const router = express.Router()
  * @apiHeader (Response Headers) {String} Content-Type application/json; charset=utf-8
  *
  * @apiExample Usage example
- * curl -i -L -X GET "http://localhost:5000/api/listScenes"
+ * curl -i -L -X GET "http://diran.univ-littoral.fr/api/listScenes"
  *
  * @apiSuccess {String[]} data List of available scenes
  * @apiSuccessExample {json} Success response example