require authentication for todos,

use in-memody db for tests
This commit is contained in:
2018-05-30 21:42:30 +03:00
parent fd142c8710
commit db46f1a2b4
16 changed files with 601 additions and 118 deletions

View File

@@ -1,10 +1,10 @@
const mongoose = require('mongoose');
const config = require('./');
const { host, port, name } = config.db;
const connectionString = `mongodb://${host}:${port}/${name}`;
async function connect() {
const { host, port, name } = config.db;
const connectionString = `mongodb://${host}:${port}/${name}`;
await mongoose.connect(connectionString);
}

View File

@@ -11,15 +11,8 @@ const dev = {
},
secret: process.env.DEV_SECRET || 'devsecret',
};
const test = {
app: {
port: process.env.TEST_APP_PORT || 4001,
},
db: {
host: process.env.TEST_DB_HOST || 'localhost',
port: process.env.TEST_DB_PORT || 27017,
name: process.env.TEST_DB_NAME || 'todolistTest',
},
secret: process.env.TEST_SECRET || 'testsecret',
};