The client library js file is not loading. Trying to load socket.io into my project but the client is not detecting the javascript library that is supposed to be served automatically. here is my code.
var express = require('express') , passport = require('passport') , util = require('util') , session = require('express-session') , SteamStrategy = require('../../').Strategy , Steam = require('machinepack-steam') , path = require('path') , app = express() , http = require('http') , socket = require('socket.io') ; app.set('port', process.env.PORT || 2053); var server = http.createServer(app).listen(app.get('port'), function(){ console.log("Express server listening on port " + app.get('port')); }); var io = socket.listen(server); io.sockets.on('connection', function () { console.log('hello world im a hot socket'); }); var steamkey = 'redacted'; passport.serializeUser(function(user, done) { done(null, user); }); passport.deserializeUser(function(obj, done) { done(null, obj); }); passport.use(new SteamStrategy({ returnURL: 'https://get-a.team/auth/steam/return', realm: 'https://get-a.team', apiKey: steamkey }, function(identifier, profile, done) { // asynchronous verification, for effect... process.nextTick(function () { profile.identifier = identifier; return done(null, profile); }); } )); app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.use(session({ secret: 'your secret', name: 'name of session id', resave: true, saveUninitialized: true})); app.use(passport.initialize()); app.use(passport.session()); app.use(express.static(path.join('public'))); app.get('/', function(req, res){ if(req.user){ res.redirect('/account'); } else { res.render('index', { user: req.user }); } }); app.get('/search/:appid', ensureAuthenticated, function(req, res){ if(Number.isInteger(+req.params.appid)){ res.render('search', { user: req.user, appid: req.params.appid }); } else { res.render('error', { user: req.user, error: "Wrong url format "+req.params.appid }); } }) app.get('/account', ensureAuthenticated, function(req, res){ Steam.getOwnedGames({ steamid: req.user.id, key: steamkey, include_appinfo: 1, include_played_free_games: 1, appids_filter: [], }).exec({ // An unexpected error occurred. error: function(err) { console.error(err); }, // OK. success: function(result) { //console.log(result); // save every game that isnt already saved res.render('account', { user: req.user, games: result }); }, }); }); app.get('/logout', function(req, res){ req.logout(); res.redirect('/'); }); app.get('/auth/steam', passport.authenticate('steam', { failureRedirect: '/' }), function(req, res) { res.redirect('/'); }); app.get('/auth/steam/return', passport.authenticate('steam', { failureRedirect: '/' }), function(req, res) { res.redirect('/account'); }); app.listen(3000); function ensureAuthenticated(req, res, next) { if (req.isAuthenticated()) { return next(); } res.redirect('/'); } Any help will be greatly appreciated
I've tried many different ways to include the socket library online but none works, even code copied directly from the socket.io website.
I tried localhost:2053/socket.io/socket.io.js and it still won't work. Not sure what im doing wrong