From de2618b7578e612d441416a26c8f39c39286f1d2 Mon Sep 17 00:00:00 2001 From: Ayush Date: Fri, 3 Aug 2018 02:26:08 +0530 Subject: [PATCH 1/3] added todoDatabase and socket.io chat app --- README.md | 2 +- .../Ayush Poddar/Socket.io-chat/package.json | 16 ++ .../Ayush Poddar/Socket.io-chat/public/app.js | 47 ++++ .../Socket.io-chat/public/index.html | 26 ++ .../Socket.io-chat/public/style.css | 33 +++ .../Socket.io-chat/public/username.html | 10 + .../Ayush Poddar/Socket.io-chat/server.js | 63 +++++ .../todoList-database/database.js | 105 ++++++++ .../todoList-database/package.json | 18 ++ .../todoList-database/public/app.js | 242 ++++++++++++++++++ .../todoList-database/public/index.html | 40 +++ .../todoList-database/public/style.css | 164 ++++++++++++ .../Ayush Poddar/todoList-database/server.js | 147 +++++++++++ 13 files changed, 912 insertions(+), 1 deletion(-) create mode 100644 Summer2018/Ayush Poddar/Socket.io-chat/package.json create mode 100644 Summer2018/Ayush Poddar/Socket.io-chat/public/app.js create mode 100644 Summer2018/Ayush Poddar/Socket.io-chat/public/index.html create mode 100644 Summer2018/Ayush Poddar/Socket.io-chat/public/style.css create mode 100644 Summer2018/Ayush Poddar/Socket.io-chat/public/username.html create mode 100644 Summer2018/Ayush Poddar/Socket.io-chat/server.js create mode 100644 Summer2018/Ayush Poddar/todoList-database/database.js create mode 100644 Summer2018/Ayush Poddar/todoList-database/package.json create mode 100644 Summer2018/Ayush Poddar/todoList-database/public/app.js create mode 100644 Summer2018/Ayush Poddar/todoList-database/public/index.html create mode 100644 Summer2018/Ayush Poddar/todoList-database/public/style.css create mode 100644 Summer2018/Ayush Poddar/todoList-database/server.js diff --git a/README.md b/README.md index 58b47eb..7c3753e 100644 --- a/README.md +++ b/README.md @@ -96,4 +96,4 @@ ### Summer 2018 - Ayush Poddar - - **[Portfolio](https://mr-magnificent.github.io/)** + - **[Portfolio](https://mr-magnificent.github.io/)** \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/Socket.io-chat/package.json b/Summer2018/Ayush Poddar/Socket.io-chat/package.json new file mode 100644 index 0000000..05aa174 --- /dev/null +++ b/Summer2018/Ayush Poddar/Socket.io-chat/package.json @@ -0,0 +1,16 @@ +{ + "name": "sockt", + "version": "1.0.0", + "description": "Socket application with implimentation for chat", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Ayush Poddar", + "license": "ISC", + "dependencies": { + "express": "^4.16.3", + "socket.io": "^2.1.1" + }, + "devDependencies": {} +} diff --git a/Summer2018/Ayush Poddar/Socket.io-chat/public/app.js b/Summer2018/Ayush Poddar/Socket.io-chat/public/app.js new file mode 100644 index 0000000..b7bebd7 --- /dev/null +++ b/Summer2018/Ayush Poddar/Socket.io-chat/public/app.js @@ -0,0 +1,47 @@ + + +$(document).ready(function () { + let btn = $('#btn'); + // let inp = $('#inp').val(); + let list = $('#list'); + let prmt; + + while (!prmt) { + prmt = prompt("Please enter your name"); + } + + let socket = io(); + + + + socket.emit('name', prmt); + + socket.on('initConnect', function (data) { + console.log(data); + $('#connected').text(''); + for (let id in data) { + if (data.hasOwnProperty(id)) { + console.log(data[id]); + $('#connected').append(`
  • ${data[id]}
  • `); + } + } + }); + + socket.on('chat', function (data) { + data.forEach(function(chatItem) { + list.append(`
  • ${chatItem[1]}:- ${chatItem[0]}
  • `); + }) + }); + + btn.click(function () { + let inp = $('#inp').val(); + console.log(inp); + socket.emit('message', [inp, prmt]); + list.append(`
  • ${prmt}:- ${inp}
  • `); + }); + + socket.on('reciveData', function (data) { + console.log(data); + list.append(`
  • ${data[1]}:- ${data[0]}
  • `); + }) +}) \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/Socket.io-chat/public/index.html b/Summer2018/Ayush Poddar/Socket.io-chat/public/index.html new file mode 100644 index 0000000..fc93633 --- /dev/null +++ b/Summer2018/Ayush Poddar/Socket.io-chat/public/index.html @@ -0,0 +1,26 @@ + + + + + Sock-t + + + + + +
    + +
    +
    +

    People Connected

    + +
    +
    + + +
    + + + + + \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/Socket.io-chat/public/style.css b/Summer2018/Ayush Poddar/Socket.io-chat/public/style.css new file mode 100644 index 0000000..79f57a9 --- /dev/null +++ b/Summer2018/Ayush Poddar/Socket.io-chat/public/style.css @@ -0,0 +1,33 @@ +.container { + display: flex; + flex-wrap: wrap; + width: 100%; + height: 100%; + margin: 0 auto; + font-size: 0; +} + +.chat-area { + height: 75vh; + width: 74%; + font-size: initial; + border-right: black dashed; + border-bottom: black dashed; + margin: 0 auto; + overflow-y: scroll; +} + +.connection-area { + height: 75vh; + width: 25%; + overflow-y: scroll; + font-size: initial; +} + +.input-area { + height: 25vh; + width: 100%; + display: table-cell; + font-size: initial; + vertical-align: middle; +} \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/Socket.io-chat/public/username.html b/Summer2018/Ayush Poddar/Socket.io-chat/public/username.html new file mode 100644 index 0000000..92f8649 --- /dev/null +++ b/Summer2018/Ayush Poddar/Socket.io-chat/public/username.html @@ -0,0 +1,10 @@ + + + + Username + + + + + + \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/Socket.io-chat/server.js b/Summer2018/Ayush Poddar/Socket.io-chat/server.js new file mode 100644 index 0000000..0e80198 --- /dev/null +++ b/Summer2018/Ayush Poddar/Socket.io-chat/server.js @@ -0,0 +1,63 @@ +let express = require('express'); +let app = express(); + +let server = require('http').Server(app); + +let io = require('socket.io')(server); + +let nameObj = {}; +let initChat = []; + +let PORT = process.env.PORT || 5000; +/* +console.log(app); +console.log(); +console.log(server); +console.log(); +console.log(io); +console.log(); +*/ + + +app.use('/', express.static('./public')); + + +io.on('connection', function (socket) { + + socket.on('name', function (data) { + console.log(data); + nameObj[socket.id] = data; + console.log('name'); + console.log(nameObj); + io.sockets.emit('initConnect', nameObj); + }); + + + socket.emit('chat', initChat); + + socket.on('message', function (data) { + socket.broadcast.emit('reciveData', data); + console.log(data); + initChat.push(data); + }); + + socket.on('disconnect', function () { + delete nameObj[socket.id]; + console.log('disconnect'); + console.log(nameObj); + io.sockets.emit('initConnect', nameObj); + console.log(Object.keys(nameObj).length); + if (Object.keys(nameObj).length === 0) { + + initChat = []; + } + + }) +}); + + + + +server.listen(PORT, function () { + console.log('Server is listening on port ' + PORT); +}); diff --git a/Summer2018/Ayush Poddar/todoList-database/database.js b/Summer2018/Ayush Poddar/todoList-database/database.js new file mode 100644 index 0000000..6503fd1 --- /dev/null +++ b/Summer2018/Ayush Poddar/todoList-database/database.js @@ -0,0 +1,105 @@ +const mongodb = require('mongodb').MongoClient; +let topUser = require('mongodb').ObjectID("5b63484919df04139569136e"); + +const uri = 'mongodb://localhost:27017'; + +let database; +let collection; + +function connectDb() { + console.log("inside connectDb"); + mongodb.connect(uri, function (err, client) { + console.log("inside mongodb.connect"); + if (err) { + console.log(err); + throw err; + } + database = client.db('todo'); + collection = database.collection('collection'); + + // console.log(collection); + + // global.insertNewUser = insertNewUser; + // global.insertTodo = insertTodo; + // global.retrieveAll = retrieveAll; + // global.deleteElement = deleteElement; + // global.updateElement = updateElement; + // global.deleteMul = deleteMul; + }); +} + +function insertNewUser (userID) { + collection.insertOne({ + user: { + userId: userID + } + }); +} + +function getUserTop (callback) { + collection.find({"_id" : topUser}).toArray(function (err, result) { + if (err) { + console.log(err); + throw err; + } + console.log(result); + incrementUserTop(result); + callback(result); + }) +} + +function incrementUserTop(data) { + data = parseInt(data[0]['userTop']); + collection.updateOne({"userTop": data}, {$set :{'userTop' : ++data}}); +} + + + +function insertTodo(userID, task, status, callback) { + userID = parseInt(userID); + task = task.toString(); + console.log(userID, task); + status = status.toString(); + collection.updateOne({'user.userId': userID},{$set: {[task]: status}}); + callback(task); +} + + + +function retrieveAll(userID, callback) { + console.log(userID); + collection.find({"user.userId": userID}).toArray(function (err, result) { + if (err) { + console.log(err); + throw err; + } + console.log(result); + callback(result); + }); +} + +function deleteElement(userID, task) { + collection.updateOne({ "user.userId": userID}, { $unset: { [task]: ""}}); +} + +function updateElement(userID, task, newTask, callback) { + collection.updateOne({ "user.userId": userID}, { $rename: { [task]: newTask}}); + callback(newTask); +} + +function deleteMul(userID, taskArr) { + taskArr.forEach(function (task) { + collection.updateOne({ "user.userId": userID}, { $unset: { [task]: ""}}); + }) +} + +module.exports = { + insertNewUser, + insertTodo, + retrieveAll, + deleteElement, + deleteMul, + updateElement, + connectDb, + getUserTop +}; \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/todoList-database/package.json b/Summer2018/Ayush Poddar/todoList-database/package.json new file mode 100644 index 0000000..642f0d7 --- /dev/null +++ b/Summer2018/Ayush Poddar/todoList-database/package.json @@ -0,0 +1,18 @@ +{ + "name": "database-integration", + "version": "1.0.0", + "description": "", + "main": "database.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "author": "", + "license": "ISC", + "dependencies": { + "body-parser": "^1.18.3", + "cookie-parser": "^1.4.3", + "express": "^4.16.3", + "mongodb": "^3.1.1", + } +} diff --git a/Summer2018/Ayush Poddar/todoList-database/public/app.js b/Summer2018/Ayush Poddar/todoList-database/public/app.js new file mode 100644 index 0000000..575df0d --- /dev/null +++ b/Summer2018/Ayush Poddar/todoList-database/public/app.js @@ -0,0 +1,242 @@ +let todoList; +let delMul = []; +let taskArr = []; +let result = $('#list'); +let inp = $('#inp'); +// let userID; +// let ind = 0; +$(document).ready(function(){ + + (function () { + let userID = Cookies.get('userID'); + console.log(userID); + if (!userID) { + let res = prompt("Are you a new user (y/n)"); + if (res[0].toLowerCase() === 'y') { + $.ajax({ + url: '/newuser', + method: 'get', + success: function (data) { + $('#userid').text(`${data}`); + // userID = data; + Cookies.set('userID', `${data}`); + } + }) + } + else { + console.log("not a new user"); + let userid; + while (!userid) { + userid = prompt("Enter you UserID"); + } + userid = Number(userid); + + if (userid.toString() !== 'NaN') { + console.log(userid); + Cookies.set('userID', userid.toString()); + $('#userid').text(`${userid}`); + } + } + } else { + $('#userid').text(`${userID}`); + } + }()); + + display(); + + function display(){ + let data = JSON.parse(localStorage.getItem('todo')) || []; + console.log(data); + if(data.length) { + render(data); + todoList = data; + } + else { + $.ajax({ + url: '/display', + method: 'get', + success: function(data) { + localStorage.setItem('todo', JSON.stringify(data)); + render(data); + todoList = data; + } + }) + } + } +}); + + + +function makeRequest() { + + let input = inp.val(); + let tick = $('#tick'); + tick.css('visibility', 'visible'); + + setTimeout(function () { + tick.css('visibility', 'hidden'); + }, 400); + + if (!input) { + return null; + } + + let test = { + "task" : input, + "done": false + }; + + inp.val(''); + + $.ajax({ + url: '/add', + method: 'post', + data: {todo: test}, + + success: function(data) { + todoList[0][data] = "false"; + localStorage.setItem('todo', JSON.stringify(todoList)); + result.append(`
  • + + ${data} + + +
  • ` + ) + } + }); +} + + +function render(data) { + console.log(data); + for(let prop in data[0]) { + if (prop === "user" || prop === "_id" || !data[0].hasOwnProperty(prop)) { + continue; + } + result.append(`
  • + + ${prop} + + +
  • `) + } +} + + +/* +* +* +* Used to element +* +* */ + + + + +function deleteKey(element) { + let index = $(element).parent().index(); + let task = $(element).prev().text(); + console.log(task); + + $.ajax({ + url: '/delete', + method: 'post', + data: {todo: task}, + success: function() { + $(element).parent().remove(); + console.log(index); + console.log(todoList); + console.log(todoList[0][task]); + delete todoList[0][task]; + localStorage.setItem('todo', JSON.stringify(todoList)); + } + }) + +} + + + +/* +* +* +* This is code for updation of an element of +* todo list +* +* +* */ + + +function updateKey(element) { + + let parent = $(element).parent(); + let index = parent.index(); + let prevVal = $(element).prev().prev().text(); + let newVal = prompt('Enter New Value'); + if (!newVal) { + return; + } + $.ajax({ + url: '/update', + method: 'post', + data: {val: newVal, prevVal: prevVal}, + success: function (data) { + parent.html(` + ${data} + + `); + delete todoList[0][prevVal]; + todoList[0][newVal] = false; + localStorage.setItem('todo', JSON.stringify(todoList)); + } + }) +} + + +function deleteMultiple() { + console.log(taskArr); + $.ajax ({ + url: '/deleteMultiple', + method: 'POST', + data: {task: taskArr}, + success: function(data) { + delMul.sort(); + delMul.reverse(); + for (let i = 0; i < delMul.length; i++) { + $('#list').children().eq(delMul[i]).remove(); + delete todoList[taskArr[i]]; + } + localStorage.setItem('todo', JSON.stringify(todoList)); + delMul = taskArr = []; + } + }); +} + +function selMultiple(element) { + let index = $(element).parent().index(); + console.log('hello'); + if (!element.checked) { + console.log('hello'); + for (let i = 0; i < delMul.length; i++) { + if (delMul[i] === index) { + delMul.splice(i, 1); + taskArr.splice(i, 1); + } + } + } + else { + delMul.push(index); + taskArr.push($(element).next().text()); + } +} + +// Call the function at the top, display() + +/* +* function display() { +* +* Get Request at /display route +* Loop that todoList and append on the page +* } + * +* */ \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/todoList-database/public/index.html b/Summer2018/Ayush Poddar/todoList-database/public/index.html new file mode 100644 index 0000000..423b66e --- /dev/null +++ b/Summer2018/Ayush Poddar/todoList-database/public/index.html @@ -0,0 +1,40 @@ + + + + + DoToday + + + + +
    + +
    +
    +
    +
    +

    Do-Today

    +

    A simplistic ToDo List for everyday tasks

    +
    + + + +
    +

    + +
    +
    +
    + Your UserID is   +
    +
    +
    +
    +
      +
      +
      + + + + + \ No newline at end of file diff --git a/Summer2018/Ayush Poddar/todoList-database/public/style.css b/Summer2018/Ayush Poddar/todoList-database/public/style.css new file mode 100644 index 0000000..a048511 --- /dev/null +++ b/Summer2018/Ayush Poddar/todoList-database/public/style.css @@ -0,0 +1,164 @@ +body { + margin: 0 auto; +} + +.body { + display: flex; + flex-wrap: wrap; + font-size: 0; + width: 100%; + height: 100vh; + margin:0 auto; +} + +#delmul { + position: absolute; + top: 5px; + right: 10px; + display: none; +} + +#delmul > button { + background-color: rgb(252, 29, 34); + border: 0; + border-radius: 5px; +} + +* { + box-sizing: border-box; +} + +.title { + width: 40%; + font-size: initial; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + color: white; + background-color: rgb(60, 60, 60); +} + +.title input { + width: 80%; + height: 30px; + border: none; + padding-left: 6%; + margin: 0; + background: transparent; +} + +.title > div { + max-width: 90%; +} + +.title > div > div { + background-color: white; + border-radius: 80px 80px 80px 80px; + position: relative; + top: 0; +} + +#tick { + position: absolute; + left: 74%; + top: 21%; + visibility: hidden; + height: 19px; +} + +.title > div > div > button { + height: 36px; + margin: 0 -1px 0 0; + width: 18%; + border: 0; + border-top-right-radius: 80px; + border-bottom-right-radius: 80px; + background-color: darkgrey; + cursor: pointer; +} + +.title > div > button { + background-color: rgba(252, 29, 34, 0.58); + color: #ffffff; + border: 0; + border-radius: 5px; + cursor: pointer; +} + +.title > div > button > * { + vertical-align: middle; +} + +.title p { + margin-bottom: 30px; +} + +.main { + width: 60%; + overflow-y: scroll; + height: 100vh; + font-size: initial; +} + +#list { + margin-top: 30px; +} + +#list > li { + padding-bottom: 15px; + max-width: 500px; + padding-left: 20px; +} + +.updDel { + float: right; + opacity: 0; + transition: opacity 0.1s ease-in; +} + +.updDel > img { + height: 16px; +} + +li:hover .updDel{ + opacity: 1; + transition: opacity 0.3s ease-in; +} + +#userid { + color: rgba(185, 255, 193, 0.92); +} + +@media screen and (max-width: 636px) { + .body { + display: flex; + flex-direction: column; + } + + .main { + overflow-y: scroll; + /*over*/ + order: 1; + width: 100%; + height: 60vh; + } + + .title { + height: 40vh; + width: 100%; + order: 3; + } + + .title p { + margin-bottom: 20px; + } + + #delmul { + display: initial; + } + + .title > div > button { + display: none; + } +} diff --git a/Summer2018/Ayush Poddar/todoList-database/server.js b/Summer2018/Ayush Poddar/todoList-database/server.js new file mode 100644 index 0000000..ac0ba23 --- /dev/null +++ b/Summer2018/Ayush Poddar/todoList-database/server.js @@ -0,0 +1,147 @@ +const server = require('express'); +const app = server(); + + + +const bodyParser = require('body-parser'); + +const cookieParser = require('cookie-parser'); + +/* +* +* This file creates the connection to the database +* +* */ +const db = require('./database'); + + + +// parse application/x-www-form-urlencoded +app.use(cookieParser()); +app.use('/',server.static('public')); + +app.use(bodyParser.urlencoded({ extended: true })); +// parse application/json +app.use(bodyParser.json()); + + +/* +* +* since the elements are not stored on the server +* we dont need todoList[] +* +* */ +// var todoList = []; + +app.get('/newuser', function (req, res) { + getUserTop(function (data) { + let userTop = parseInt(data[0]["userTop"]); + db.insertNewUser(++userTop); + res.cookie("userID", userTop, { + expires: new Date(2147483647000) + }); + res.send(userTop.toString()); + }) + +}); + +function getUserTop (callback) { + db.getUserTop(function (data) { + callback(data); + }) +} + + +app.post('/add', function(req,res) { + let userID = req.cookies.userID; + let todo = req.body.todo; + console.log(todo); + // todo = JSON.parse(todo); + todo = todo.task; + console.log(todo, "inside /add: ", userID, "userID"); + let done = false; + + /* + * + * This send the new todo + * entry in the database + * and return the id of the data element + * in the database + * + * + * */ + db.insertTodo(userID, todo, done, function (data) { + res.send(data); + }); + +}); + + + + +app.post('/delete', function(req,res){ + let userID = parseInt(req.cookies.userID); + let task = (req.body.todo).toString(); + // task = task.task; + /* + * + * This deletes the index + * + * + * */ + db.deleteElement(userID, task); + res.sendStatus(200); +}); + + + + + +app.get('/display', function(req,res) { + // Send TodoList Array to the client + // res.send(todoList); + /* + * + * since we need to send the data from the data base we can use telescoping + * that calls the display () in the database.js + * + * */ + let userId = parseInt(req.cookies.userID); + console.log(userId, "inside display"); + db.retrieveAll(userId, function (data) { + console.log(data); + res.send(data); + }) +}); + + + + + +app.post ('/update', function (req, res) { + let newval = req.body.val.toString(); + let prevVal = req.body.prevVal.toString(); + let done = false; + let userID = parseInt(req.cookies.userID); + + db.updateElement(userID, prevVal, newval, function (data) { + res.send(data); + }) +}); + + + + + +app.post ('/deleteMultiple', function (req, res) { + let task = req.body.task; + let userID = parseInt(req.cookies.userID); + console.log(task); + db.deleteMul(userID, task); + res.sendStatus(200); +}); + +app.listen(5000, function() { + console.log("Server running on port 5000"); + db.connectDb(); +}); \ No newline at end of file From 8a97e25021dc3c5f98227e7dc6ab4e2514144645 Mon Sep 17 00:00:00 2001 From: Ayush Date: Fri, 3 Aug 2018 04:22:53 +0530 Subject: [PATCH 2/3] final amends made --- Summer2018/Ayush Poddar/todoList-database/database.js | 4 ++-- Summer2018/Ayush Poddar/todoList-database/package.json | 2 +- Summer2018/Ayush Poddar/todoList-database/public/app.js | 5 +++-- Summer2018/Ayush Poddar/todoList-database/server.js | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Summer2018/Ayush Poddar/todoList-database/database.js b/Summer2018/Ayush Poddar/todoList-database/database.js index 6503fd1..a821dac 100644 --- a/Summer2018/Ayush Poddar/todoList-database/database.js +++ b/Summer2018/Ayush Poddar/todoList-database/database.js @@ -1,7 +1,7 @@ const mongodb = require('mongodb').MongoClient; -let topUser = require('mongodb').ObjectID("5b63484919df04139569136e"); +let topUser = require('mongodb').ObjectID("5b637cfde7179a0733452cea"); -const uri = 'mongodb://localhost:27017'; +const uri = 'YOUR_DATABASE_URI'; let database; let collection; diff --git a/Summer2018/Ayush Poddar/todoList-database/package.json b/Summer2018/Ayush Poddar/todoList-database/package.json index 642f0d7..621cbda 100644 --- a/Summer2018/Ayush Poddar/todoList-database/package.json +++ b/Summer2018/Ayush Poddar/todoList-database/package.json @@ -13,6 +13,6 @@ "body-parser": "^1.18.3", "cookie-parser": "^1.4.3", "express": "^4.16.3", - "mongodb": "^3.1.1", + "mongodb": "^3.1.1" } } diff --git a/Summer2018/Ayush Poddar/todoList-database/public/app.js b/Summer2018/Ayush Poddar/todoList-database/public/app.js index 575df0d..6ddc32e 100644 --- a/Summer2018/Ayush Poddar/todoList-database/public/app.js +++ b/Summer2018/Ayush Poddar/todoList-database/public/app.js @@ -1,4 +1,4 @@ -let todoList; +let todoList = [{}]; let delMul = []; let taskArr = []; let result = $('#list'); @@ -20,6 +20,7 @@ $(document).ready(function(){ $('#userid').text(`${data}`); // userID = data; Cookies.set('userID', `${data}`); + document.location.reload(true); } }) } @@ -204,7 +205,7 @@ function deleteMultiple() { delMul.reverse(); for (let i = 0; i < delMul.length; i++) { $('#list').children().eq(delMul[i]).remove(); - delete todoList[taskArr[i]]; + delete todoList[0][taskArr[i]]; } localStorage.setItem('todo', JSON.stringify(todoList)); delMul = taskArr = []; diff --git a/Summer2018/Ayush Poddar/todoList-database/server.js b/Summer2018/Ayush Poddar/todoList-database/server.js index ac0ba23..79d1b0c 100644 --- a/Summer2018/Ayush Poddar/todoList-database/server.js +++ b/Summer2018/Ayush Poddar/todoList-database/server.js @@ -14,7 +14,7 @@ const cookieParser = require('cookie-parser'); * */ const db = require('./database'); - +let PORT = process.env.PORT || 5000; // parse application/x-www-form-urlencoded app.use(cookieParser()); @@ -141,7 +141,7 @@ app.post ('/deleteMultiple', function (req, res) { res.sendStatus(200); }); -app.listen(5000, function() { - console.log("Server running on port 5000"); +app.listen(PORT, function() { + console.log("Server running on port ", PORT); db.connectDb(); }); \ No newline at end of file From 6bf52a61bb5c7f889140f61c340f3c49992e4b2e Mon Sep 17 00:00:00 2001 From: Ayush Poddar Date: Fri, 3 Aug 2018 04:28:57 +0530 Subject: [PATCH 3/3] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c3753e..d10fa40 100644 --- a/README.md +++ b/README.md @@ -96,4 +96,7 @@ ### Summer 2018 - Ayush Poddar - - **[Portfolio](https://mr-magnificent.github.io/)** \ No newline at end of file + - **[Portfolio](https://mr-magnificent.github.io/)** + - **[Socket.io (Chatisry)](https://chatistry.herokuapp.com/)** + - **[todo (with database)](https://dotodaytodo.herokuapp.com/)** + - **[Lyricist (spotify+lastFm+lyrics API)](https://lyricspot.herokuapp.com/)**