mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-31 07:43:33 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			689 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			689 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import express from "express";
 | |
| import internalReport from "../internal/report.js";
 | |
| import jwtdecode from "../lib/express/jwt-decode.js";
 | |
| import { express as logger } from "../logger.js";
 | |
| 
 | |
| const router = express.Router({
 | |
| 	caseSensitive: true,
 | |
| 	strict: true,
 | |
| 	mergeParams: true,
 | |
| });
 | |
| 
 | |
| router
 | |
| 	.route("/hosts")
 | |
| 	.options((_, res) => {
 | |
| 		res.sendStatus(204);
 | |
| 	})
 | |
| 	.all(jwtdecode())
 | |
| 
 | |
| 	/**
 | |
| 	 * GET /reports/hosts
 | |
| 	 */
 | |
| 	.get(async (req, res, next) => {
 | |
| 		try {
 | |
| 			const data = await internalReport.getHostsReport(res.locals.access);
 | |
| 			res.status(200).send(data);
 | |
| 		} catch (err) {
 | |
| 			logger.debug(`${req.method.toUpperCase()} ${req.path}: ${err}`);
 | |
| 			next(err);
 | |
| 		}
 | |
| 	});
 | |
| 
 | |
| export default router;
 |