server side cleanup

This commit is contained in:
Jori Lallo 2016-08-27 10:48:56 -07:00
parent 6e39cebb08
commit ac6cf2ea8f
8 changed files with 11 additions and 9 deletions

View File

@ -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": {

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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) {

View File

@ -23,4 +23,4 @@ export default function validation() {
return next();
};
}
}

View File

@ -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();