| 
									
										
										
										
											2018-12-06 18:03:56 +01:00
										 |  |  | 'use strict'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const path = require('path'); | 
					
						
							| 
									
										
										
										
											2019-06-08 18:50:07 +02:00
										 |  |  | const koaStatic = require('koa-static'); | 
					
						
							| 
									
										
										
										
											2021-10-14 10:48:29 -04:00
										 |  |  | const swaggerUi = require('swagger-ui-dist'); | 
					
						
							| 
									
										
										
										
											2018-12-06 18:03:56 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-05 11:39:02 -04:00
										 |  |  | module.exports = async ({ strapi }) => { | 
					
						
							|  |  |  |   strapi.server.routes([ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       method: 'GET', | 
					
						
							|  |  |  |       path: '/plugins/documentation/(.*)', | 
					
						
							|  |  |  |       async handler(ctx, next) { | 
					
						
							|  |  |  |         ctx.url = path.basename(ctx.url); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         return koaStatic(swaggerUi.getAbsoluteFSPath(), { | 
					
						
							| 
									
										
										
										
											2021-10-18 12:38:21 +02:00
										 |  |  |           maxage: 86400000, | 
					
						
							| 
									
										
										
										
											2021-10-05 11:39:02 -04:00
										 |  |  |           defer: true, | 
					
						
							|  |  |  |         })(ctx, next); | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       config: { | 
					
						
							|  |  |  |         auth: false, | 
					
						
							|  |  |  |       }, | 
					
						
							| 
									
										
										
										
											2019-06-08 18:50:07 +02:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-10-05 11:39:02 -04:00
										 |  |  |   ]); | 
					
						
							| 
									
										
										
										
											2019-04-15 18:57:58 +02:00
										 |  |  | }; |