This commit is contained in:
2026-04-02 17:50:10 +08:00
parent 60697d80be
commit ce0aa4f789
373 changed files with 82520 additions and 46 deletions

View File

@@ -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}`);
});
});