Giter Site home page Giter Site logo

Comments (15)

hagopj13 avatar hagopj13 commented on May 8, 2024 5

@kartikey54 Thanks a lot for the suggestions.
I will soon add instructions on deployment.
Concerning sockets, I will think about that. Is there a use case of sockets you know of that could be useful for almost everyone using this boilerplate? I tend to keep the features that are most commonly used, so that when people clone the boilerplate, they won't have to remove a lot of code before having something workable.

from node-express-boilerplate.

hagopj13 avatar hagopj13 commented on May 8, 2024 4

@kartikey54 I like the idea of having notifications, thanks. I will set this as "help wanted" for now so that other people can contribute, and if no one picks it up after some time, I will do it.

from node-express-boilerplate.

Shidooo avatar Shidooo commented on May 8, 2024 4

I found an alternative

let server = require('http').createServer(app);
mongoose.connect(config.mongoose.url, config.mongoose.options).then(() => {
  logger.info('Connected to MongoDB');

  const options = {cors: true, origins:'*'};
  const io = require('socket.io')(server, options);
  io.on('connection', socket => { 
    logger.info(`Connected ${socket.id}`);
  });

  server.listen(config.port, () => {
    logger.info(`Listening to port ${config.port}`);
  });
});

from node-express-boilerplate.

khkmalki avatar khkmalki commented on May 8, 2024 3

from node-express-boilerplate.

srikanth-interakt avatar srikanth-interakt commented on May 8, 2024 1

Thanks for the good work.
This is an excellent boilerplate I've seen so far.

Yes, Can we get sockets added to this boilerplate ?

from node-express-boilerplate.

kartikey54 avatar kartikey54 commented on May 8, 2024

from node-express-boilerplate.

hagopj13 avatar hagopj13 commented on May 8, 2024

@khkmalki thank you for the kind words. I'm glad you find it useful.

from node-express-boilerplate.

pxl-live avatar pxl-live commented on May 8, 2024

@hagopj13 I also really appreciate your boilerplate! Likewise web sockets would really be appreciated for our use case. I have tried implementing myself but just cant seem to get it to work

/node-express-mongoose-boilerplate/node_modules/engine.io/lib/server.js:458
var listeners = server.listeners('request').slice(0);
^

TypeError: Cannot read property 'listeners' of undefined

Have tried adding the following to app.js and index.js:

const http = require('http').createServer(app);
const io = require('socket.io')(http);
io.listen();

from node-express-boilerplate.

kartikey54 avatar kartikey54 commented on May 8, 2024

@hagopj13 I also really appreciate your boilerplate! Likewise web sockets would really be appreciated for our use case. I have tried implementing myself but just cant seem to get it to work

/node-express-mongoose-boilerplate/node_modules/engine.io/lib/server.js:458
var listeners = server.listeners('request').slice(0);
^

TypeError: Cannot read property 'listeners' of undefined

Have tried adding the following to app.js and index.js:

const http = require('http').createServer(app);
const io = require('socket.io')(http);
io.listen();

Can you share a link to your repo?

from node-express-boilerplate.

pxl-live avatar pxl-live commented on May 8, 2024

@kartikey54 Sure!! I have forked and created my changes there.

https://github.com/pxl-live/node-express-mongoose-boilerplate

from node-express-boilerplate.

hagopj13 avatar hagopj13 commented on May 8, 2024

@pxl-live I tried running the code in your fork and it worked (after adding the socket.io dependency).
Are you still facing issues?

from node-express-boilerplate.

Bshah88 avatar Bshah88 commented on May 8, 2024

@hagopj13 I was going through the code and you have build an awesome production ready boilerplate. Thanks for this. I would like to ask a question regarding the logout functionality. Are we removing the tokens from DB when user logs out? Please reply....
CC: @kartikey54 @pxl-live @AndreiEnache @khkmalki

from node-express-boilerplate.

hagopj13 avatar hagopj13 commented on May 8, 2024

@Bshah88 thanks for the kind words.
We don't have a logout API yet. Please open a separate issue for that.

from node-express-boilerplate.

Shidooo avatar Shidooo commented on May 8, 2024

How do you @hagopj13 use the solution of @pxl-live ? I've tested it on my side and it doesn't seem to work...

All requests to my socket are catched here
app.use((req, res, next) => { next(new ApiError(httpStatus.NOT_FOUND, 'Not found')); });
Looks like the socket was not attached to the application at all and everything passes through.

error: GET /socket.io/?EIO=3&transport=polling&t=NTtgBqg 404 - 54.230 ms - message: Not found

Thanks for helping

from node-express-boilerplate.

hacker8-eng avatar hacker8-eng commented on May 8, 2024

Oi

from node-express-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.