You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It provides basic functionalities to manage to-do list items including add, delete, and update the status as complete or incomplete. The to-do list items are on a database on MongoDB Atlas for easy access.
CRUD app created using Node, Express, MongoDB Atlas. The app functions include -- Create, Read, Update and Delete data that are on a MongoDB Atlas database using Node and Express.
11
+
12
+
## How to Use:
13
+
14
+
### Set up & Requirements to Play with it on your local machine
**For more information, check out MongoDB Docs on [Connection Strings](https://www.mongodb.com/docs/manual/reference/connection-string/)**
39
+
40
+
## Lessons Learned:
41
+
42
+
Learned how to create a simple API that allows users to handle data on MongoDB via creating requests to Post, Get, Put, Delete via server and render results as HTML using EJS engine.
db.collection('todos').insertOne({thing: request.body.todoItem,completed: false})// find 'todos' collection and insert the object to database. toDoItem is the body of input from the forms.
40
46
.then(result=>{
41
-
console.log('Todo Added')
42
-
response.redirect('/')
47
+
console.log('Todo Added')// console log so we know this happened
48
+
response.redirect('/')// response to refresh the page -> trigger get('/') req
43
49
})
44
-
.catch(error=>console.error(error))
50
+
.catch(error=>console.error(error))// catch and log error
0 commit comments