styled swagger
This commit is contained in:
		@@ -48,6 +48,9 @@ app.use('/', require('./routes/root'));
 | 
			
		||||
app.use('/', require('./routes/user'));
 | 
			
		||||
app.use('/', require('./routes/material'));
 | 
			
		||||
 | 
			
		||||
// static files
 | 
			
		||||
app.use('/static', express.static('static'));
 | 
			
		||||
 | 
			
		||||
// Swagger UI
 | 
			
		||||
let apiDoc: JSONSchema = {};
 | 
			
		||||
jsonRefParser.bundle('api/api.yaml', (err, doc) => {
 | 
			
		||||
@@ -56,7 +59,7 @@ jsonRefParser.bundle('api/api.yaml', (err, doc) => {
 | 
			
		||||
  apiDoc.paths = apiDoc.paths.allOf.reduce((s, e) => Object.assign(s, e));
 | 
			
		||||
  swagger.setup(apiDoc, {defaultModelsExpandDepth: -1, customCss: '.swagger-ui .topbar { display: none }'});
 | 
			
		||||
});
 | 
			
		||||
app.use('/api', swagger.serve, swagger.setup(apiDoc, {defaultModelsExpandDepth: -1, customCss: '.swagger-ui .topbar { display: none }'}));
 | 
			
		||||
app.use('/api', swagger.serve, swagger.setup(apiDoc, {customCssUrl: '/static/styles/swagger.css'}));
 | 
			
		||||
 | 
			
		||||
app.use((req, res) => {  // 404 error handling
 | 
			
		||||
  res.status(404).json({status: 'Not found'});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user