initial commit

This commit is contained in:
Wyatt Johnson
2018-06-16 17:20:51 -06:00
commit 02e1236792
39 changed files with 5258 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { MongoClient, Db } from 'mongodb';
import { Config } from 'talk-server/config';
/**
* create will connect to the MongoDB instance identified in the configuration.
*
* @param config application configuration.
*/
export async function create(config: Config): Promise<Db> {
// Connect and create a client for MongoDB.
const client = await MongoClient.connect(config.get('mongodb'));
// Return the database handle, which defaults to the database name provided
// in the config connection string.
return client.db();
}