uptime monitor endpoint
This commit is contained in:
		
							
								
								
									
										0
									
								
								src/service/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/service/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										19
									
								
								src/service/uptime.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/service/uptime.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
import express from "express";
 | 
			
		||||
import pack from "../../package.json";
 | 
			
		||||
import startupTime from "../tools/startupTime";
 | 
			
		||||
 | 
			
		||||
const app = express();
 | 
			
		||||
 | 
			
		||||
app.get("/", (_req, res) => {
 | 
			
		||||
    res.status(200).json({
 | 
			
		||||
        running: true,
 | 
			
		||||
        version: pack.version,
 | 
			
		||||
        runningSince: startupTime.toISOString()
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
app.all("*", (_req, res) => {
 | 
			
		||||
    res.status(404).end();
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
app.listen(80);
 | 
			
		||||
		Reference in New Issue
	
	Block a user