forked from urfu-2017/webdev-task-5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (19 loc) · 716 Bytes
/
index.js
File metadata and controls
25 lines (19 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const mongoose = require('mongoose');
const Queries = require('./queries');
(async () => {
await mongoose.connect('mongodb://localhost/webdev-task-5');
const queries = new Queries(mongoose, {
souvenirsCollection: 'souvenirs',
cartsCollection: 'carts'
});
try {
// Здесь можно делать запросы, чтобы проверять, что они правильно работают
const result = await queries.addReview('5abe65514d0c9d02c12eaf55',
{ login: 'steve', rating: 5, text: 'test' });
console.info(result);
} catch (error) {
console.error(error);
}
await mongoose.disconnect();
})();