Skip to content

Commit

Permalink
Todo List
Browse files Browse the repository at this point in the history
  • Loading branch information
suraj7564 committed May 26, 2022
0 parents commit 7101089
Show file tree
Hide file tree
Showing 10 changed files with 1,938 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
25 changes: 25 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const express = require('express');
const mongoose = require('mongoose');

const app = express();

//Connection to mongoDb
mongoose.connect('mongodb://localhost/todolist',{
useNewUrlParser : true,
useUnifiedTopology : true,
});


//middlewares
app.use(express.urlencoded({extended:true}));
app.use(express.static("public"));
app.set("view engine","ejs")


//routes
app.use(require("./routes/index"));
app.use(require("./routes/todo"));

//Server Configuration
app.listen(3000 ,() => console.log('Server started at port : 3000'));

10 changes: 10 additions & 0 deletions models/Todo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const mongoose = require("mongoose");

const TodoSchema = new mongoose.Schema({
todo:{
type : String,
required : true,
},
});

module.exports = new mongoose.model("Todo",TodoSchema);
Loading

0 comments on commit 7101089

Please sign in to comment.