File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed
Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 11package-lock.json
2- secrets.json
2+ secrets.js
Original file line number Diff line number Diff line change 33 "version" : " 1.0.0" ,
44 "description" : " " ,
55 "main" : " index.js" ,
6+ "type" : " module" ,
67 "scripts" : {
78 "dev" : " nodemon server.js"
89 },
Original file line number Diff line number Diff line change 1- {
1+ export default {
22 "mongoConnection": "",
3- "test" : " "
43}
Original file line number Diff line number Diff line change 1- const express = require ( 'express' ) ;
2- const bodyParser = require ( 'body-parser' )
1+ import express from 'express' ;
2+ import bodyParser from 'body-parser' ;
33const app = express ( ) ;
4- const ObjectID = require ( 'mongodb' ) . ObjectID ;
5- const MongoClient = require ( 'mongodb' ) . MongoClient
6- const config = require ( './secrets.json' ) ;
4+ import * as mongodb from 'mongodb' ;
5+ import config from './secrets.js' ;
76
87async function getMongoCollection ( ) {
9- const client = new MongoClient ( config . mongoConnection ) ;
8+ const client = new mongodb . MongoClient ( config . mongoConnection ) ;
109 await client . connect ( ) ;
1110 const database = client . db ( "todo-app" ) ;
1211 return database . collection ( "todos" ) ;
You can’t perform that action at this time.
0 commit comments