Skip to content

Commit

Permalink
switch to ES6 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasvanrijsse committed Feb 21, 2021
1 parent ae58c91 commit 148e91d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Week3/todo backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
package-lock.json
secrets.json
secrets.js
1 change: 1 addition & 0 deletions Week3/todo backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"dev": "nodemon server.js"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
export default {
"mongoConnection": "",
"test": ""
}
11 changes: 5 additions & 6 deletions Week3/todo backend/server.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const express = require('express');
const bodyParser = require('body-parser')
import express from 'express';
import bodyParser from 'body-parser';
const app = express();
const ObjectID = require('mongodb').ObjectID;
const MongoClient = require('mongodb').MongoClient
const config = require('./secrets.json');
import * as mongodb from 'mongodb';
import config from './secrets.js';

async function getMongoCollection() {
const client = new MongoClient(config.mongoConnection);
const client = new mongodb.MongoClient(config.mongoConnection);
await client.connect();
const database = client.db("todo-app");
return database.collection("todos");
Expand Down

0 comments on commit 148e91d

Please sign in to comment.