mirror of
https://github.com/Foltik/Shimapan
synced 2025-01-05 15:58:03 -05:00
Fix some warnings
This commit is contained in:
parent
b01b0ece6b
commit
82e9989b2b
@ -2,9 +2,10 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const config = require('config');
|
||||
|
||||
const User = require('../models/User.js');
|
||||
const Upload = require('../models/Upload.js');
|
||||
const Key = require('../models/Key.js');
|
||||
const ModelPath = '../models/';
|
||||
const User = require(ModelPath + 'User.js');
|
||||
const Upload = require(ModelPath + 'Upload.js');
|
||||
const Key = require(ModelPath + 'Key.js');
|
||||
|
||||
const multer = require('multer');
|
||||
const fileUpload = multer({dest: config.get('Upload.path')}).single('file');
|
||||
@ -38,7 +39,7 @@ const updateStats = async req =>
|
||||
]);
|
||||
|
||||
|
||||
router.post('/', requireAuth('file.upload'), fileUpload, wrap(async (req, res, next) => {
|
||||
router.post('/', requireAuth('file.upload'), fileUpload, wrap(async (req, res) => {
|
||||
if (!req.file)
|
||||
return res.status(400).json({message: 'No file specified.'});
|
||||
|
||||
|
@ -16,7 +16,7 @@ const dbHost = config.get('Database.host');
|
||||
let db;
|
||||
mongoose.connect(dbHost, {useNewUrlParser: true})
|
||||
.then(() => {
|
||||
console.log('Connected to mongodb server ' + dbHost);
|
||||
console.log('Connected to database ' + dbHost);
|
||||
db = mongoose.connection;
|
||||
});
|
||||
|
||||
@ -44,8 +44,8 @@ app.use(session({
|
||||
}));
|
||||
|
||||
// Middleware
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
app.use(passport.initialize(null));
|
||||
app.use(passport.session(null));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.json({ type: 'application/*+json' }));
|
||||
app.use(bodyParser.urlencoded({ extended: true }));
|
||||
@ -62,7 +62,7 @@ require('./app/routes/routes.js')(app);
|
||||
require('./config/passport.js');
|
||||
|
||||
// Error handler
|
||||
app.use((err, req, res, next) => {
|
||||
app.use((err, req, res) => {
|
||||
console.error(err.stack);
|
||||
res.status(500).json({'message': 'Internal server error.'});
|
||||
});
|
||||
|
12
test/api.js
12
test/api.js
@ -2,12 +2,12 @@ process.env.NODE_ENV = 'test';
|
||||
|
||||
const chai = require('chai');
|
||||
chai.use(require('chai-http'));
|
||||
const should = chai.should();
|
||||
|
||||
const User = require('../app/models/User.js');
|
||||
const Invite = require('../app/models/Invite.js');
|
||||
const Upload = require('../app/models/Upload.js');
|
||||
const Key = require('../app/models/Key.js');
|
||||
const ModelPath = '../app/models/';
|
||||
const User = require(ModelPath + 'User.js');
|
||||
const Upload = require(ModelPath + 'Upload.js');
|
||||
const Key = require(ModelPath + 'Key.js');
|
||||
const Invite = require(ModelPath + 'Invite.js');
|
||||
|
||||
const util = require('./testUtil.js');
|
||||
const canonicalize = require('../app/util/canonicalize').canonicalize;
|
||||
@ -171,7 +171,7 @@ describe('Accounts', function() {
|
||||
});
|
||||
|
||||
it('SHOULD accept any non-normalized variant of a username with a valid password', async () => {
|
||||
await util.create
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user