diff --git a/task-management/client/.gitignore b/task-management/client/.gitignore
new file mode 100644
index 0000000..4d29575
--- /dev/null
+++ b/task-management/client/.gitignore
@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
diff --git a/task-management/client/README.md b/task-management/client/README.md
new file mode 100644
index 0000000..0c83cde
--- /dev/null
+++ b/task-management/client/README.md
@@ -0,0 +1,70 @@
+# Getting Started with Create React App
+
+This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
+
+## Available Scripts
+
+In the project directory, you can run:
+
+### `npm start`
+
+Runs the app in the development mode.\
+Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
+
+The page will reload if you make edits.\
+You will also see any lint errors in the console.
+
+### `npm test`
+
+Launches the test runner in the interactive watch mode.\
+See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
+
+### `npm run build`
+
+Builds the app for production to the `build` folder.\
+It correctly bundles React in production mode and optimizes the build for the best performance.
+
+The build is minified and the filenames include the hashes.\
+Your app is ready to be deployed!
+
+See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
+
+### `npm run eject`
+
+**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
+
+If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
+
+Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
+
+You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
+
+## Learn More
+
+You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
+
+To learn React, check out the [React documentation](https://reactjs.org/).
+
+### Code Splitting
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
+
+### Analyzing the Bundle Size
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
+
+### Making a Progressive Web App
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
+
+### Advanced Configuration
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
+
+### Deployment
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
+
+### `npm run build` fails to minify
+
+This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
diff --git a/task-management/client/package.json b/task-management/client/package.json
new file mode 100644
index 0000000..225e621
--- /dev/null
+++ b/task-management/client/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "client",
+ "version": "0.1.0",
+ "private": true,
+ "dependencies": {
+ "@testing-library/jest-dom": "^5.15.1",
+ "@testing-library/react": "^11.2.7",
+ "@testing-library/user-event": "^12.8.3",
+ "axios": "^0.24.0",
+ "moment": "^2.29.1",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2",
+ "react-scripts": "4.0.3",
+ "redux": "^4.1.2",
+ "redux-thunk": "^2.4.1",
+ "sass": "^1.45.1",
+ "web-vitals": "^1.1.2"
+ },
+ "scripts": {
+ "start": "react-scripts start",
+ "build": "react-scripts build",
+ "test": "react-scripts test",
+ "eject": "react-scripts eject"
+ },
+ "eslintConfig": {
+ "extends": [
+ "react-app",
+ "react-app/jest"
+ ]
+ },
+ "browserslist": {
+ "production": [
+ ">0.2%",
+ "not dead",
+ "not op_mini all"
+ ],
+ "development": [
+ "last 1 chrome version",
+ "last 1 firefox version",
+ "last 1 safari version"
+ ]
+ }
+}
diff --git a/task-management/client/public/favicon.ico b/task-management/client/public/favicon.ico
new file mode 100644
index 0000000..a11777c
Binary files /dev/null and b/task-management/client/public/favicon.ico differ
diff --git a/task-management/client/public/index.html b/task-management/client/public/index.html
new file mode 100644
index 0000000..aa069f2
--- /dev/null
+++ b/task-management/client/public/index.html
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ React App
+
+
+ You need to enable JavaScript to run this app.
+
+
+
+
diff --git a/task-management/client/public/logo192.png b/task-management/client/public/logo192.png
new file mode 100644
index 0000000..fc44b0a
Binary files /dev/null and b/task-management/client/public/logo192.png differ
diff --git a/task-management/client/public/logo512.png b/task-management/client/public/logo512.png
new file mode 100644
index 0000000..a4e47a6
Binary files /dev/null and b/task-management/client/public/logo512.png differ
diff --git a/task-management/client/public/manifest.json b/task-management/client/public/manifest.json
new file mode 100644
index 0000000..080d6c7
--- /dev/null
+++ b/task-management/client/public/manifest.json
@@ -0,0 +1,25 @@
+{
+ "short_name": "React App",
+ "name": "Create React App Sample",
+ "icons": [
+ {
+ "src": "favicon.ico",
+ "sizes": "64x64 32x32 24x24 16x16",
+ "type": "image/x-icon"
+ },
+ {
+ "src": "logo192.png",
+ "type": "image/png",
+ "sizes": "192x192"
+ },
+ {
+ "src": "logo512.png",
+ "type": "image/png",
+ "sizes": "512x512"
+ }
+ ],
+ "start_url": ".",
+ "display": "standalone",
+ "theme_color": "#000000",
+ "background_color": "#ffffff"
+}
diff --git a/task-management/client/public/robots.txt b/task-management/client/public/robots.txt
new file mode 100644
index 0000000..e9e57dc
--- /dev/null
+++ b/task-management/client/public/robots.txt
@@ -0,0 +1,3 @@
+# https://www.robotstxt.org/robotstxt.html
+User-agent: *
+Disallow:
diff --git a/task-management/client/src/App.js b/task-management/client/src/App.js
new file mode 100644
index 0000000..6fdec76
--- /dev/null
+++ b/task-management/client/src/App.js
@@ -0,0 +1,21 @@
+import React,{useEffect} from 'react';
+import Main from './Components/Main'
+
+
+
+
+const App = ()=>{
+ useEffect(() => {
+ document.title = "Task Manager";
+ }, []);
+
+ return(
+
+
+
+
+ )
+
+}
+
+export default App;
\ No newline at end of file
diff --git a/task-management/client/src/Components/Main.js b/task-management/client/src/Components/Main.js
new file mode 100644
index 0000000..ed4c5f7
--- /dev/null
+++ b/task-management/client/src/Components/Main.js
@@ -0,0 +1,132 @@
+import { useState, useEffect } from "react";
+import "../Styles/main.scss";
+import StatusLine from "./StatusLine";
+import axios from "axios";
+
+function Main() {
+ const [tasks, setTasks] = useState([]);
+
+ function getTasks() {
+ axios
+ .get("http://localhost:8000/tasks")
+ .then((res) => {
+ const data = res.data;
+ setTasks([...data]);
+ console.log("Data received");
+ console.log(data);
+ console.log(tasks);
+ })
+ .catch(() => alert("Error receiving data"));
+ }
+
+ useEffect(() => {
+ getTasks();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ function addEmptyTask(status) {
+ const lastTask = tasks[tasks.length - 1];
+
+ let newTaskId = 1;
+
+ if (lastTask !== undefined) {
+ newTaskId = lastTask.id + 1;
+ }
+
+ let isCompleted;
+ isCompleted = status === "Done" ? true : false;
+ setTasks((tasks) => [
+ ...tasks,
+ {
+ id: newTaskId,
+ isCompleted: isCompleted,
+ },
+ ]);
+ }
+ function cancelChange(task) {}
+
+ function addTask(taskToAdd) {
+ let filteredTasks = tasks.filter((task) => {
+ return task.id !== taskToAdd.id;
+ });
+ console.log(taskToAdd);
+ let updatedtask = tasks.filter(
+ (task) => task._id === taskToAdd._id && taskToAdd._id !== undefined
+ )[0];
+ console.log(updatedtask);
+ if (updatedtask !== undefined) {
+ axios
+ .put(`http://localhost:8000/tasks/${updatedtask.id}`, taskToAdd)
+ .then((response) => console.log(response))
+ .catch((err) => console.log(err));
+ } else {
+ axios
+ .post("http://localhost:8000/tasks", taskToAdd)
+ .then((response) => {
+ console.log(response);
+ let newTaskList = [...filteredTasks, taskToAdd];
+ getTasks();
+ setTasks(newTaskList);
+ })
+ .catch((err) => console.log(err));
+ }
+ }
+
+ function deleteTask(taskId) {
+ let filteredTasks = tasks.filter((task) => {
+ return task.id !== taskId;
+ });
+ let deletedtask = tasks.filter((task) => task.id === taskId)[0]._id;
+ axios
+ .delete(`http://localhost:8000/tasks/${deletedtask}`)
+ .then((res) => setTasks(filteredTasks));
+ }
+
+ function moveTask(id, _id) {
+ let task = tasks.filter((task) => {
+ return task.id === id;
+ })[0];
+ let filteredTasks = tasks.filter((task) => {
+ return task.id !== id;
+ });
+ task.isCompleted = true;
+ let newTaskList = [...filteredTasks, task];
+ setTasks(newTaskList);
+ axios
+ .put(`http://localhost:8000/tasks/${task.id}`,{isCompleted: true})
+ .then((response) => console.log(response))
+ .catch((err) => console.log(err));
+
+ }
+ return (
+
+
Task Manager
+
+
+
+
+ );
+}
+
+export default Main;
diff --git a/task-management/client/src/Components/StatusLine.js b/task-management/client/src/Components/StatusLine.js
new file mode 100644
index 0000000..18eb815
--- /dev/null
+++ b/task-management/client/src/Components/StatusLine.js
@@ -0,0 +1,53 @@
+import "../Styles/statusLine.scss";
+import Task from "./Task";
+
+export default function StatusLine(props) {
+ const {
+ status,
+ tasks,
+ addTask,
+ deleteTask,
+ addEmptyTask,
+ moveTask,
+ isCompleted,
+ cancelChange,
+ } = props;
+
+ let taskList, tasksCompletion;
+
+ function handleAddEmpty() {
+ addEmptyTask(status);
+ console.log(status);
+ }
+
+ if (tasks) {
+ tasksCompletion = tasks.filter((task) => {
+ return task.isCompleted === isCompleted;
+ });
+ }
+
+ if (tasksCompletion) {
+ taskList = tasksCompletion.map((task) => {
+ return (
+ addTask(task)}
+ deleteTask={(id) => deleteTask(id)}
+ moveTask={(id, _id) => moveTask(id, _id)}
+ cancelChange={(task) => cancelChange(task)}
+ key={task.id}
+ task={task}
+ />
+ );
+ });
+ }
+
+ return (
+
+
{status}
+ {taskList}
+
+ +
+
+
+ );
+}
diff --git a/task-management/client/src/Components/Task.js b/task-management/client/src/Components/Task.js
new file mode 100644
index 0000000..4a58ada
--- /dev/null
+++ b/task-management/client/src/Components/Task.js
@@ -0,0 +1,161 @@
+import "../Styles/task.scss";
+import { useState } from "react";
+
+export default function Task(props) {
+ const { addTask, deleteTask, moveTask, task, cancelChange } = props;
+
+ const [priorityLevel, setPriorityLevel] = useState(task.priority);
+ const [collapsed, setCollapsed] = useState(task.isCollapsed);
+ const [formAction, setFormAction] = useState("");
+
+ function setPriority(event) {
+ setPriorityLevel(event.target.attributes.priority.value);
+ }
+
+ function handleSubmit(event) {
+ event.preventDefault();
+ if (formAction === "save") {
+ if (collapsed) {
+ setCollapsed(false);
+ } else {
+ if (task._id !== undefined) {
+ let newTask = {
+ _id: task._id,
+ id: task.id,
+ title: event.target.elements.title.value,
+ description: event.target.elements.description.value,
+ deadline: event.target.elements.date.value,
+ isCompleted: task.isCompleted,
+ priority: priorityLevel,
+ isCollapsed: true,
+ };
+ addTask(newTask);
+ } else {
+ let newTask = {
+ id: task.id,
+ title: event.target.elements.title.value,
+ description: event.target.elements.description.value,
+ deadline: event.target.elements.date.value,
+ isCompleted: task.isCompleted,
+ priority: priorityLevel,
+ isCollapsed: true,
+ };
+ addTask(newTask);
+ }
+ setCollapsed(true);
+ }
+ }
+
+ if (formAction === "delete") {
+ deleteTask(task.id);
+ }
+ if (formAction === "cancel") {
+ setCollapsed(true);
+ cancelChange(task);
+ }
+ }
+
+ function handleCompletion() {
+ moveTask(task.id, task._id);
+ }
+
+ return (
+
+
+ {collapsed && (
+
+ »
+
+ )}
+
+ );
+}
diff --git a/task-management/client/src/Styles/_properties.scss b/task-management/client/src/Styles/_properties.scss
new file mode 100644
index 0000000..63b05d6
--- /dev/null
+++ b/task-management/client/src/Styles/_properties.scss
@@ -0,0 +1,9 @@
+$blue: #132743;
+$grey: #686d76;
+$white: #eeecda;
+$gold: #edc988;
+$green: #9ad3bc;
+$yellow: #edf285;
+$pink: #ffa5a5;
+$red: #ff8282;
+$highlight: #2ec1ac;
diff --git a/task-management/client/src/Styles/main.scss b/task-management/client/src/Styles/main.scss
new file mode 100644
index 0000000..7064bea
--- /dev/null
+++ b/task-management/client/src/Styles/main.scss
@@ -0,0 +1,99 @@
+@import url("https://fonts.googleapis.com/css2?family=Kanit:wght@100;200;300;400;500;600;700;800;900&display=swap");
+@import "properties.scss";
+
+* {
+ margin: 0;
+ padding: 0;
+}
+
+body {
+ font-family: "Kanit", sans-serif;
+ background-color: #292A32;
+ color: $white;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ text-align: center;
+}
+
+h1 {
+ margin: 2rem 0;
+ font-weight: 500;
+}
+
+main {
+ display: flex;
+ flex-direction: column;
+ border: 1px solid $green;
+ align-items: center;
+ width: 100rem;
+}
+
+section {
+ display: flex;
+ width: 90%;
+ margin-bottom: 2rem;
+}
+
+.button {
+ border: 1px solid $gold;
+ text-transform: uppercase;
+ width: fit-content;
+ padding: 0.3rem 1.5rem;
+ background-color: $green;
+ border-color: $green;
+ color: $blue;
+ font-weight: 500;
+ font-family: "Kanit", sans-serif;
+ border-radius: 0.25rem;
+ font-size: 1rem;
+ margin-right: 0.25rem;
+
+ &:hover {
+ background-color: $highlight;
+ border-color: $highlight;
+ cursor: pointer;
+ }
+
+ &:focus {
+ outline: none;
+ border-color: $highlight;
+ background-color: $highlight;
+ color: $white;
+ }
+
+ &.addTask {
+ font-size: 3rem;
+ padding: 0 0 0.4rem 0;
+ border-radius: 50%;
+ width: 2.5rem;
+ height: 2.5rem;
+ line-height: 1rem;
+ margin-top: 2rem;
+ }
+
+ &.moveTask {
+ font-size: 1.5rem;
+ padding: 0.5rem 0.5rem;
+ margin-bottom: 0;
+ line-height: 1rem;
+ }
+
+ &.delete {
+
+ background-color: $pink;
+ border-color: $pink;
+
+ &:hover {
+ background-color: $red;
+ border-color: $red;
+ }
+ }
+}
+
+@media only screen and (max-width: 75rem) {
+ section {
+ width: 100%;
+ flex-direction: column;
+ }
+}
diff --git a/task-management/client/src/Styles/statusLine.scss b/task-management/client/src/Styles/statusLine.scss
new file mode 100644
index 0000000..e4beffc
--- /dev/null
+++ b/task-management/client/src/Styles/statusLine.scss
@@ -0,0 +1,18 @@
+@import "properties.scss";
+
+.statusLine {
+ width: 100%;
+ margin: 0 0.5rem;
+
+ h3 {
+ font-weight: 500;
+ font-size: 25px;
+ margin: 1rem 0;
+ }
+}
+
+@media only screen and (max-width: 75rem) {
+ .statusLine {
+ width: initial;
+ }
+}
diff --git a/task-management/client/src/Styles/task.scss b/task-management/client/src/Styles/task.scss
new file mode 100644
index 0000000..07d7384
--- /dev/null
+++ b/task-management/client/src/Styles/task.scss
@@ -0,0 +1,188 @@
+@import "properties.scss";
+
+.task {
+ padding: 1rem;
+ margin-bottom: 0.5rem;
+ display: flex;
+ align-items: flex-end;
+ border: 1px solid $white;
+ border-radius: 0.25rem;
+
+ &.collapsedTask {
+
+ .moveTask {
+ margin-bottom: 0.5rem;
+ font-size: 1.5rem;
+ padding: 0.3rem 0.5rem;
+
+ }
+ }
+
+ form {
+ display: flex;
+ flex-direction: column;
+ text-align: center;
+ align-items: center;
+ .input {
+ background-color: transparent;
+ border: 1px solid transparent;
+ border-radius: 0.25rem;
+ color: $white;
+ text-align: center;
+ resize: none;
+ display: flex;
+ font-family: "Kanit", sans-serif;
+
+ &:hover {
+ cursor: pointer;
+ border: 1px solid $white;
+ }
+
+ &:focus {
+ outline: none;
+ border-color: $gold;
+ color: $gold;
+ }
+
+ &::placeholder {
+ color: $white;
+ }
+ }
+
+ .title {
+ margin-bottom: 0.5rem;
+ padding: 0.5rem 0;
+ width: 100%;
+ font-size: 1.1rem;
+
+ &:hover {
+ cursor: text;
+ }
+ }
+
+ .description {
+ margin-bottom: 0.5rem;
+ padding: 0.5rem;
+ width: 100%;
+ font-size: 1.1rem;
+
+ &:hover {
+ cursor: text;
+ }
+ }
+
+ .priorityLabels {
+ margin-bottom: 1.5rem;
+ display: flex;
+ flex-direction: row;
+
+ label {
+ color: $blue;
+ padding: 0.05rem 0.5rem;
+ margin: 0 0.25rem;
+ text-transform: uppercase;
+ border-radius: 0.25rem;
+
+ .icon {
+ font-size: 1.25rem;
+ margin-right: 0.25rem;
+ transition: all 0.4s ease-in-out;
+
+ &.hide {
+ display: none;
+ }
+
+ &.show {
+ display: inline-block;
+ }
+ }
+
+ input {
+ display: none;
+ }
+
+ &.low {
+ background-color: $green;
+
+ &:hover {
+ cursor: pointer;
+ background-color: $highlight;
+ border-color: $highlight;
+ }
+ }
+
+ &.medium {
+ background-color: $yellow;
+
+ &:hover {
+ cursor: pointer;
+ background-color: $highlight;
+ border-color: $highlight;
+ }
+ }
+
+ &.high {
+ background-color: $pink;
+
+ &:hover {
+ cursor: pointer;
+ background-color: $highlight;
+ border-color: $highlight;
+ }
+ }
+
+ &.selected {
+ font-weight: 700;
+ }
+ }
+ }
+
+ &.collapsed {
+ flex-direction: row;
+ align-content: center;
+
+ .title {
+ margin: 0;
+
+ &:hover {
+ border-color: transparent;
+ cursor: default;
+ }
+ }
+
+ .priorityLabels {
+ margin-bottom: 0;
+ margin-right: 1rem;
+ }
+
+ .description,
+ label {
+ display: none;
+ }
+
+ label.selected {
+ display: inline-block;
+ font-weight: 500;
+ }
+
+ .button {
+ padding: 0.025rem 0.5rem;
+
+ &.moveTask {
+ background-color: red;
+ }
+ }
+
+ &:hover .button {
+ display: inline-block;
+ }
+ }
+ &.notcollapsed{
+ padding-left: 33%;
+ .button{
+ margin-bottom: 1rem;
+ }
+
+ }
+ }
+}
diff --git a/task-management/client/src/index.js b/task-management/client/src/index.js
new file mode 100644
index 0000000..79fbbcd
--- /dev/null
+++ b/task-management/client/src/index.js
@@ -0,0 +1,7 @@
+import ReactDOM from 'react-dom';
+import React from 'react';
+
+import App from './App';
+
+ReactDOM.render( , document.getElementById('root'));
+
diff --git a/task-management/dummy_data.js b/task-management/dummy_data.js
index ff3139c..5a1e7de 100644
--- a/task-management/dummy_data.js
+++ b/task-management/dummy_data.js
@@ -1,4 +1,4 @@
-module.exports = [
+const fake_data = [
{
'id': 1234,
'title': 'Prepare Business Model',
@@ -23,4 +23,10 @@ module.exports = [
'deadline': 20-02-2021,
'isCompleted': false
},
- ];
\ No newline at end of file
+];
+
+exports.fake_data = fake_data;
+
+
+
+
diff --git a/task-management/server/db/index.js b/task-management/server/db/index.js
index 05aaea5..596f6e2 100644
--- a/task-management/server/db/index.js
+++ b/task-management/server/db/index.js
@@ -1,3 +1,30 @@
/**
* Connect to the Database with Mongoose here
- */
\ No newline at end of file
+ */
+
+
+const mongoose = require("mongoose");
+//import mongoose from 'mongoose';
+
+module.exports = ()=>{
+
+ try{
+ const CONNECTION_URL = 'mongodb+srv://taskManagement:taskManagement123@cluster0.zsxkl.mongodb.net/TaskManagement?retryWrites=true&w=majority'
+ mongoose.connect(CONNECTION_URL, {useNewUrlParser :true, useUnifiedTopology: true});
+
+ const con = mongoose.connection;
+
+ con.on("open", ()=> {console.log("Connected...")});
+
+ }catch(err){
+ console.log("Could not connect to the database");
+
+ }
+}
+
+
+
+
+
+
+
diff --git a/task-management/server/index.js b/task-management/server/index.js
index 66cd61e..f6db931 100644
--- a/task-management/server/index.js
+++ b/task-management/server/index.js
@@ -1,3 +1,36 @@
/**
* Your server comes here
- */
\ No newline at end of file
+ */
+const express = require("express");
+const bodyParser = require("body-parser");
+const cors = require("cors");
+const connection = require("../server/db/index");
+const taskRouter = require("./routes/tasks");
+//import express from 'express';
+//import bodyParser from 'body-parser'
+//import cors from 'cors';
+//import connection from '../server/db/index.js'
+
+
+const app = express();
+connection();
+
+app.use(bodyParser.json({limit : "30mb", extended: true}));
+app.use(bodyParser.urlencoded({limit : "30mb",extended: true}));
+app.use(express.json());
+
+app.use(cors());
+
+
+const PORT = process.env.PORT || 8000;
+
+
+/*connection
+ .then(()=> app.listen(PORT, ()=> console.log(`server is running on port:${PORT}`)))
+ .catch((error)=> console.log(error.message));
+*/
+app.use('/tasks',taskRouter);
+app.listen(PORT,()=> console.log(`server is running on port :${PORT}`));
+
+
+
diff --git a/task-management/server/models/Task.js b/task-management/server/models/Task.js
new file mode 100644
index 0000000..7b5e82b
--- /dev/null
+++ b/task-management/server/models/Task.js
@@ -0,0 +1,36 @@
+const mongoose = require("mongoose");
+const Schema = mongoose.Schema;
+
+
+
+const taskSchema = new Schema({
+
+ id : {
+ type: Number,
+ },
+ title : {
+ type: String,
+ required : true
+ },
+ description : {
+ type:String,
+ },
+ deadline : {
+ type :String,
+ required :true
+ },
+ isCompleted : {
+ type: Boolean,
+ required:true
+ },
+ priority : {
+ type : String,
+ },
+ isCollapsed : {
+ type : Boolean,
+ require:true
+ }
+});
+
+
+module.exports = mongoose.model("Task",taskSchema);
\ No newline at end of file
diff --git a/task-management/server/package.json b/task-management/server/package.json
new file mode 100644
index 0000000..b5b0751
--- /dev/null
+++ b/task-management/server/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "server",
+ "version": "1.0.0",
+ "description": "",
+ "main":"index.js",
+
+ "scripts": {
+ "start": "nodemon index.js",
+ "seed-database": "node seed.js"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "body-parser": "^1.19.0",
+ "cors": "^2.8.5",
+ "express": "^4.17.1",
+ "mongodb": "^4.1.4",
+ "mongoose": "^6.0.14",
+ "nodemon": "^2.0.15"
+ }
+}
diff --git a/task-management/server/routes/tasks.js b/task-management/server/routes/tasks.js
new file mode 100644
index 0000000..c5a5ecf
--- /dev/null
+++ b/task-management/server/routes/tasks.js
@@ -0,0 +1,82 @@
+const express = require("express");
+
+const router = express.Router();
+const Task = require("../models/Task");
+
+
+router.post("/", async(req,res)=>{
+
+ const task = new Task({
+ id : req.body.id,
+ title: req.body.title,
+ deadline: req.body.deadline,
+ description : req.body.description,
+ isCompleted: req.body.isCompleted,
+ priority: req.body.priority,
+ isCollapsed: true
+ });
+
+ try{
+
+ const t1 = await task.save();
+ res.json(t1);
+
+ }catch(err){
+ res.send('Error'+ err);
+ }
+
+});
+
+
+router.get("/", async(req,res)=>{
+
+ try{
+ const tasks = await Task.find();
+ res.json(tasks);
+ }catch (err){
+ res.send('Error'+ err);
+ }
+
+});
+
+router.get("/:id", async(req,res)=>{
+
+ try{
+ const task = await Task.findById(req.params.id);
+ res.json(task);
+ }catch (err){
+ res.send('Error'+ err);
+ }
+
+});
+
+router.put("/:id", async(req,res)=> {
+
+ try{
+ const task = await Task.findOneAndUpdate(
+ {id: req.params.id}, req.body
+ )
+ res.json(task);
+
+ }catch(err){
+ res.send('Error'+ err);
+ }
+
+});
+
+router.delete("/:id", async(req,res)=>{
+
+ try{
+
+ const task = await Task.findByIdAndDelete(req.params.id);
+ res.json(task);
+
+ }catch(err){
+ res.send('Error'+ err);
+ }
+
+});
+
+
+
+module.exports = router;
\ No newline at end of file
diff --git a/task-management/server/seed.js b/task-management/server/seed.js
new file mode 100644
index 0000000..2bb9c32
--- /dev/null
+++ b/task-management/server/seed.js
@@ -0,0 +1,42 @@
+const data = require("../dummy_data").fake_data;
+const MongoClient = require("mongodb").MongoClient;
+//import fake_Data from '../dummy_data.js';
+//import MongoClient from 'mongodb';
+
+
+async function seedDB(){
+ const uri = 'mongodb+srv://taskManagement:taskManagement123@cluster0.zsxkl.mongodb.net/TaskManagement?retryWrites=true&w=majority';
+
+ const client = new MongoClient(uri, {
+ useNewUrlParser: true, useUnifiedTopology: true});
+
+
+ try {
+
+ await client.connect(()=> {const collection = client.db("TaskManagement").collection("Tasks");
+ collection.drop();
+
+ collection.insertMany(data);
+ console.log("Database seeded :)");
+ client.close();
+ });
+
+
+
+ }catch (err){
+ console.log(err.stack);
+ }
+}
+
+seedDB();
+
+
+
+
+
+
+
+
+
+
+