
const { info } = require('../../../lib/db');

module.exports = async function (req, res, next) {

	try {
		res.status(200).json(await info.get(req.params.project, req.params.path, req.query, req.user?.operations));
	} catch (err) {
		if (err instanceof TypeError) {
			res.status(404).json(null);
		} else {
			next(err);
			return;
		}
	}
	next();

};
