server side cleanup
This commit is contained in:
parent
6e39cebb08
commit
ac6cf2ea8f
|
@ -9,6 +9,8 @@
|
|||
}}], // Spaces inside curlies, except prop={{}}
|
||||
"react/prefer-stateless-function": 0, // Don't prefer stateless components
|
||||
"no-else-return": 0,
|
||||
"new-cap": 0,
|
||||
"no-param-reassign": 0,
|
||||
},
|
||||
"settings" : {
|
||||
"import/resolver": {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import Router from 'koa-router';
|
||||
import httpErrors from 'http-errors';
|
||||
import _ from 'lodash';
|
||||
|
||||
import auth from './authentication';
|
||||
import auth from './middlewares/authentication';
|
||||
import pagination from './middlewares/pagination';
|
||||
import { presentApiKey } from '../presenters';
|
||||
import { ApiKey } from '../models';
|
||||
|
|
|
@ -2,7 +2,7 @@ import Router from 'koa-router';
|
|||
import httpErrors from 'http-errors';
|
||||
import _ from 'lodash';
|
||||
|
||||
import auth from './authentication';
|
||||
import auth from './middlewares/authentication';
|
||||
import pagination from './middlewares/pagination';
|
||||
import { presentCollection } from '../presenters';
|
||||
import { Atlas } from '../models';
|
||||
|
|
|
@ -8,7 +8,7 @@ import isUUID from 'validator/lib/isUUID';
|
|||
|
||||
const URL_REGEX = /^[a-zA-Z0-9-]*-([a-zA-Z0-9]{10,15})$/;
|
||||
|
||||
import auth from './authentication';
|
||||
import auth from './middlewares/authentication';
|
||||
// import pagination from './middlewares/pagination';
|
||||
import { presentDocument } from '../presenters';
|
||||
import { Document, Atlas } from '../models';
|
||||
|
|
|
@ -11,7 +11,7 @@ import documents from './documents';
|
|||
import hooks from './hooks';
|
||||
import apiKeys from './apiKeys';
|
||||
|
||||
import validation from './validation';
|
||||
import validation from './middlewares/validation';
|
||||
import methodOverride from '../middlewares/methodOverride';
|
||||
import cache from '../middlewares/cache';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import httpErrors from 'http-errors';
|
||||
import JWT from 'jsonwebtoken';
|
||||
|
||||
import { User } from '../models';
|
||||
import { User } from '../../models';
|
||||
|
||||
export default function auth({ require = true } = {}) {
|
||||
return async function authMiddleware(ctx, next) {
|
||||
|
@ -19,7 +19,8 @@ export default function auth({ require = true } = {}) {
|
|||
}
|
||||
} else {
|
||||
if (require) {
|
||||
throw httpErrors.Unauthorized('Bad Authorization header format. Format is "Authorization: Bearer <token>"\n');
|
||||
throw httpErrors.Unauthorized(`Bad Authorization header format. \
|
||||
Format is "Authorization: Bearer <token>"\n`);
|
||||
}
|
||||
}
|
||||
} else if (ctx.request.query.token) {
|
|
@ -23,4 +23,4 @@ export default function validation() {
|
|||
|
||||
return next();
|
||||
};
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ import {
|
|||
makePolicy,
|
||||
signPolicy,
|
||||
} from '../utils/s3';
|
||||
import auth from './authentication';
|
||||
import auth from './middlewares/authentication';
|
||||
import { presentUser } from '../presenters';
|
||||
|
||||
const router = new Router();
|
||||
|
|
Reference in New Issue