1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-19 11:39:36 +02:00

Backend: auth for config and queries. Refactor of middleware exports

This commit is contained in:
Paweł Malak 2021-11-11 16:18:31 +01:00
parent e3f167921c
commit 22471d64c7
10 changed files with 43 additions and 31 deletions

View file

@ -1,16 +1,11 @@
const asyncWrapper = require('../../middleware/asyncWrapper');
const App = require('../../models/App');
const loadConfig = require('../../utils/loadConfig');
const ErrorResponse = require('../../utils/ErrorResponse');
// @desc Create new app
// @route POST /api/apps
// @access Public
const createApp = asyncWrapper(async (req, res, next) => {
if (!req.isAuthenticated) {
return next(new ErrorResponse('Unauthorized', 401));
}
const { pinAppsByDefault } = await loadConfig();
let app;