Skip to content

Project Structure

Marco Beltempo edited this page Feb 20, 2018 · 17 revisions

This hierarchy is based on the chaddon's master branch. Please update as new files and functions are added.


/chaddon


/src

/src/chaddon.js

//[Deprecated] - sets the the dependencies being used 
app.configure(function(){...})
//[Deprecated] - determines how express handles errors in production and development mode
app.configure('{development | production}', function()...) 
//[Deprecated] - redirects user to 'views/index.html' when accessing the root. The use of sendFile() needs to be updated. 
app.get('/', function(req, res) {
    params = req.params.id;
	res.sendfile('views/index.html', {root:__dirname});
    });
//[Deprecated] - redirects user to 'views/login.html'. The use of sendFile() needs to be updated. 
app.get('/login', function(req, res) {
        params = req.params.id;
        res.sendfile('views/login.html', {root:__dirname});
    });
//[Deprecated] - parses the parameter following 'root/' and uses it as a page id. "views/chatroom.html" is then loaded. The use of sendFile() needs to be updated. 
app.get('/:id', function(req, res) {
    params = req.params.id;
	res.sendfile('views/chatroom.html', {root:__dirname});
    });
// development mode uses `localhost:3000` | production mode uses the environment variable port
io = io.listen(app);
var port = process.env.PORT || 3000;
//decodes url characters by replacing ASCII characters
function htmlEntities(str) {...}
//activates the socket listener
//stores valid username in socket session  
io.sockets.on('connection', function(socket){..}
//adds the new user to the chatroom user list
io.sockets.in(socket.room).emit("updateUsers", {usernames:localUser[""+params]})
//appends new message after clicking the "Send" button.
socket.on('message', function(msg) {...}
//removes the user from the chatroom/ user list once they leave a chatroom
socket.on('disconnect', function() {...}

Back to Top


/package.json

See https://docs.npmjs.com/files/package.json for more info.

Back to Top

/chrome_extension

chrome_extension/content.js

//listener is fired on run time to check if the add on icon has been clicked. 
//on click the "getURL" function parses the URL and prints it to the developer console.
chrome.runtime.onMessage.addListener(
    function getUrl (request, sender, sendResponse) { ... } )

Back to Top


/src/config

db.js

index.js

/src/public

/src/public/images

Back to Top

/src/public/scripts

/src/public/scripts/chat.js

/src/public/scripts/chatroom.js

/src/public/scripts/googleAuthentication.js

Back to Top

/src/public/stylesheets

/src/public/stylesheets/login.css

/src/public/stylesheets/style.css

Back to Top


/src/routers

/src/routers/index.js

Back to Top


/src/views

/src/views/chatroom.html

/src/views/index.html

/src/views/login.html

Back to Top