Comments (15)
@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.
@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.
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.
from node-express-boilerplate.
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.
from node-express-boilerplate.
@khkmalki thank you for the kind words. I'm glad you find it useful.
from node-express-boilerplate.
@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.
@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.
@kartikey54 Sure!! I have forked and created my changes there.
https://github.com/pxl-live/node-express-mongoose-boilerplate
from node-express-boilerplate.
@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.
@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.
@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.
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.
Oi
from node-express-boilerplate.
Related Issues (20)
- Pagination Query for 'ref' documents.
- Implement oAuth Login
- pm2: command not found when run docker compose
- Can you upgrade the dependency?
- Authentication: Is refresh token never expired? HOT 4
- Multiple roles/permissions HOT 2
- Can we add commit message lint?
- Can we use release-please for the release notes and create the tags in the GIT?
- API documentation : HTTP basic authentication? HOT 1
- ERROR [node-app 5/6] RUN yarn install --pure-lockfile HOT 2
- logout api only invalidate the refresh token, but the auth token is still valid until it expires HOT 2
- xss-clean - Package no longer supported
- It adds new refresh token when another token already exist for logged in user HOT 2
- Incorrect docs route unit test
- Validation middleware isn't working with external validation HOT 5
- req.body undefined HOT 1
- Mongoose V5.5.3+ introduced .remove() deprecation
- Same token generated all the time HOT 1
- Tests failing due to MongoWriteConcern
- MongoDB data loss
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-express-boilerplate.