Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3a77eab
tracking gitignore
Alexrom789 May 31, 2018
9159b6e
Added initial files
Alexrom789 May 31, 2018
b4eb194
Merge pull request #1 from Alexrom789/master
Alexrom789 May 31, 2018
d3b1aee
created server
Alexrom789 May 31, 2018
8842321
Database model & schema created; messageController functionality to g…
rebeccaleff Jun 1, 2018
744d582
Merge pull request #3 from rebeccaleff/master
rebeccaleff Jun 1, 2018
d7039a2
worked a bit on front end. Got basic chat box div up.
Alexrom789 Jun 1, 2018
44233f7
Merge pull request #2 from Alexrom789/master
Alexrom789 Jun 1, 2018
7438bb8
dd updates
david-dest01 Jun 1, 2018
eba2176
dd updates
david-dest01 Jun 1, 2018
19c62df
Merge pull request #5 from david-dest01/master
david-dest01 Jun 1, 2018
7dfea9a
package-lock.json
rebeccaleff Jun 1, 2018
fa33ca2
added gitignore
rebeccaleff Jun 1, 2018
ba4a9a1
package-lock.json
rebeccaleff Jun 1, 2018
d260c0a
changed gitignore
rebeccaleff Jun 1, 2018
1b51654
Server responds to client req
rebeccaleff Jun 1, 2018
80a06eb
Merge pull request #6 from rebeccaleff/master
rebeccaleff Jun 1, 2018
fcf9b32
hh
david-dest01 Jun 1, 2018
eaf4da5
completed basic front end design
Alexrom789 Jun 1, 2018
393e536
basic frontend done
Alexrom789 Jun 1, 2018
188c6bb
resolve merge conflict
Alexrom789 Jun 1, 2018
38f5904
Merge pull request #7 from Alexrom789/master
Alexrom789 Jun 1, 2018
04eaeb2
set up post request and console logs
Alexrom789 Jun 1, 2018
7a1bb0f
Merge pull request #8 from Alexrom789/master
Alexrom789 Jun 1, 2018
b53d8ff
Chats showing on screen
rebeccaleff Jun 2, 2018
a59968e
dd version
david-dest01 Jun 2, 2018
1c31b26
Merge pull request #9 from rebeccaleff/master
rebeccaleff Jun 2, 2018
202ee36
Functioning chat
rebeccaleff Jun 2, 2018
5cc06e1
Merge pull request #10 from rebeccaleff/master
rebeccaleff Jun 2, 2018
fe08869
dd updates
david-dest01 Jun 2, 2018
1b613db
Some style changes like scrollable div
Alexrom789 Jun 2, 2018
9b07da3
Merge pull request #11 from Alexrom789/master
Alexrom789 Jun 2, 2018
1d64f8e
dd newest client.js
david-dest01 Jun 2, 2018
a2b0beb
updated
david-dest01 Jun 2, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
38 changes: 38 additions & 0 deletions client/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//console.log('in here')
//username = "User"

$(document).ready(function(){
// grab created_by and message values
$("#send").click(() => {
var chatMessage = { name: $("#txtName").val(), message: $("#txtMessage").val() };
$.post("http://localhost:3000/message", chatMessage);
});

$('#txtMessage').keypress(function (e) {
if (e.which == 13) {
//console.log('I was pressed')
var chatMessage = { name: $("#txtName").val(), message: $("#txtMessage").val() };
$.post("/message", chatMessage);
chatMessage.message = '';
return false;
}
});

var length = 0;
setInterval(() => {
var response = '';
$.ajax({
type: "GET",
url: "/message",
async: false,
success : function(text) {
response = text;
if(response.length > length) {
$( "#chatlog" ).append(`${response[response.length - 1].created_by}: ${response[response.length - 1].message}<br>`);
length = response.length;
}
}
});
}, 200);
})

26 changes: 26 additions & 0 deletions client/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
body {
background-color: #2196f3;
}

.chatBox {
width: 400px;
margin: auto;
overflow: none;
}

.appTitle {
color: white;
text-align: center;
}

#chatlog {
height: 400px;
background-color:white;
border: 1px solid black;
overflow: auto;
}


#name {
color: blue;
}
25 changes: 25 additions & 0 deletions client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<title>Home page</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="./client.js"></script>
</head>
<body>
<h1 class="appTitle"> TagChat</h1>
<br>
<div class="chatBox">
<div id="chatlog"></div>
<br>
<input id='txtName' class='form-control' placeholder="name" type="text">
<br>
<textarea id="txtMessage" class="form-control" placeholder="Message"></textarea>
<br>
<button id="send" class="btn btn-info">Send</button>
</div>
</div>
</body>
</html>
Loading