Hey having issues getting the project to work all the code is correct. It even passes freeCodeCamp Testing but it does not log anything into the console of the client or into the server console.
Server
'use strict';
const express = require('express');
const app = require('express')();
const bodyParser = require('body-parser');
const cors = require('cors');
const pug = require('pug');
const session = require('express-session');
const passport = require('passport');
const mongo = require('mongodb').MongoClient;
const ObjectID = require('mongodb').ObjectId;
const bcrypt = require('bcrypt');
const http = require('http').Server(app)
const io = require('socket.io')(http)
/* Local Files */
const auth = require('./app/Auth.js');
const routes = require('./app/Routes.js');
const fccTesting = require('./freeCodeCamp/fcctesting.js');
app.set('view engine', 'pug');
app.use(cors());
fccTesting(app); //For FCC testing purposes
app.use('/public', express.static(process.cwd() + '/public'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
mongo.connect(process.env.DATABASE, (err, db) => {
if(err) {
console.log(`Database error: ${err}`);
} else {
console.log('Successful database connection');
auth(app, db);
routes(app, db);
app.listen(process.env.PORT || 3000, () => {
console.log("Listening on port: " + process.env.PORT);
});
io.on('connection', (socket) => {
console.log('A user has connected');
});
}
});
Client
html
head
title FCC Advanced Node and Express
meta(name='description', content='Home page')
link#favicon(rel='icon', href='https://hyperdev.com/favicon-app.ico', type='image/x-icon')
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(name='viewport', content='width=device-width, initial-scale=1')
link(rel='stylesheet', href='/public/style.css')
body
h1.border.center FCC Advanced Node and Express
h2.center Socket.IO Chat Room
.chat.center
p#users
.chat-box
ul#messages
form(action='')
input#m(autocomplete='off')
button Send
a#logout(href='/logout') Logout
script(src='/socket.io/socket.io.js')
script(src='https://code.jquery.com/jquery-2.2.1.min.js', integrity='sha256-gvQgAFzTH6trSrAWoH1iPo9Xc96QxSZ3feW6kem+O00=', crossorigin='anonymous')
script(src='/public/client.js')
Any help would be greatly appreciated. I have been stuck trying to get this to work for the past 2-3 days. I have even checked on socket.io’s site for help which is where I cot the /socket.io/socket.io.js