a
This commit is contained in:
60
index.js
60
index.js
@@ -1,16 +1,15 @@
|
||||
const { MongoClient, ServerApiVersion } = require('mongodb');
|
||||
const uri = 'mongodb+srv://ugochikay_db_user:bt06DpE6QZqLHZ1x>@cluster0.aqxmamw.mongodb.net/?appName=Cluster0';
|
||||
// const { MongoClient, ServerApiVersion } = require('mongodb');
|
||||
// const uri = 'mongodb+srv://ugochikay_db_user:bt06DpE6QZqLHZ1x>@cluster0.aqxmamw.mongodb.net/?appName=Cluster0';
|
||||
|
||||
//Dependancies
|
||||
const express = require("express");
|
||||
const cors = require("cors"); //Change
|
||||
const cors = require("cors");
|
||||
|
||||
const port = 3000;
|
||||
|
||||
const app = express();
|
||||
|
||||
//Middleware setup
|
||||
app.use(express.json());
|
||||
|
||||
app.use(cors("*")); //change
|
||||
|
||||
//API routes
|
||||
@@ -19,31 +18,30 @@ app.get("/get/example", async (req, res) =>{
|
||||
})
|
||||
|
||||
const tasks = [
|
||||
{
|
||||
id: 1,
|
||||
completed: false,
|
||||
title:"Wash car",
|
||||
decription: "Make sure I have washed the car well",
|
||||
dueDate: "14/03/2026",
|
||||
dateCreated: new Date(Date.now()).toLocaleString()
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
completed: true,
|
||||
title: "Audit Report",
|
||||
description: "The Audit Report must be ready by due date",
|
||||
duedate: "16/03/2026",
|
||||
dateCreated: new Date(Date.now()).toLocaleString()
|
||||
},
|
||||
|
||||
{
|
||||
id: 3,
|
||||
completed: true,
|
||||
title: "Performance Report",
|
||||
description: "The Performance Report must be ready by due date",
|
||||
duedate: "16/03/2026",
|
||||
dateCreated: new Date(Date.now()).toLocaleString()
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
completed: false,
|
||||
title:"Wash car",
|
||||
decription: "Make sure I have washed the car well",
|
||||
dueDate: "14/03/2026",
|
||||
dateCreated: new Date(Date.now()).toLocaleString()
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
completed: true,
|
||||
title: "Audit Report",
|
||||
description: "The Audit Report must be ready by due date",
|
||||
duedate: "16/03/2026",
|
||||
dateCreated: new Date(Date.now()).toLocaleString()
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
completed: true,
|
||||
title: "Performance Report",
|
||||
description: "The Performance Report must be ready by due date",
|
||||
duedate: "16/03/2026",
|
||||
dateCreated: new Date(Date.now()).toLocaleString()
|
||||
},
|
||||
];
|
||||
|
||||
//Get all Tasks
|
||||
@@ -89,4 +87,4 @@ app.post("/api/tasks/todo", async (req, res) => {
|
||||
//App startup
|
||||
app.listen(port, () => {
|
||||
console.log(`To Do App listening on port ${port}`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user