Make discord integration a module

This allows for an error message if the docker integration fails to load
This commit is contained in:
Thomas "ajnart" Camlong
2022-07-21 11:43:43 +02:00
parent 715a4bd6c7
commit 00751eeca5
17 changed files with 76 additions and 133 deletions

View File

@@ -2,11 +2,14 @@ import { NextApiRequest, NextApiResponse } from 'next';
import Docker from 'dockerode';
const docker = new Docker();
async function Get(req: NextApiRequest, res: NextApiResponse) {
const containers = await docker.listContainers({ all: true });
return res.status(200).json(containers);
try {
const docker = new Docker();
const containers = await docker.listContainers();
res.status(200).json(containers);
} catch (err) {
res.status(500).json({ err });
}
}
export default async (req: NextApiRequest, res: NextApiResponse) => {