mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 07:25:48 +01:00
✨ Make discord integration a module
This allows for an error message if the docker integration fails to load
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user