summary refs log tree commit diff
path: root/src/api/routes/stop.ts
blob: 3f49b360490d7e991643fec3dc9c7e11b6512a5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { Router, Request, Response } from "express";
import { route } from "@fosscord/api";

const router: Router = Router();

router.post(
	"/",
	route({ right: "OPERATOR" }),
	async (req: Request, res: Response) => {
		console.log(`/stop was called by ${req.user_id} at ${new Date()}`);
		res.sendStatus(200);
		process.kill(process.pid, "SIGTERM");
	},
);

export default router;