Skip to content

Duplicate 'thing' socket and route created by generator with bad path #1205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
stuarthallows opened this issue Aug 25, 2015 · 3 comments
Closed
Labels

Comments

@stuarthallows
Copy link

I ran the generator taking all defaults except for selecting LESS rather than SASS. There are two problems with the generated code.

In routes.js the routes generated are;

  app.use('/api/things', require('./api\thing'));
  app.use('/api/things', require('./api/thing'));
  app.use('/api/users', require('./api/user'));

and in socketio.js the sockets registered are;

  require('..\api\thing\thing.socket').register(socket);
  require('../api/thing/thing.socket').register(socket);

That is two thing entries, one with the slash reversed.

I'm running Windows 10, generator v3.0.0-rc4, npm 2.7.4 and node v0.12.2. I've tried cleaning all caches and reinstalling the generator.

@kingcody
Copy link
Member

There are two problems here actually:

  • The project comes with a app.use('/api/things', require('./api/thing')); route but also inserts one when generating the thing endpoint on initial creation. This problem isn't apparent until the generated route is different than the one that was already included.

Which brings us to our next problem:

  • We're using the path module to find the relative path from the routes.js and socketio.js to the required file. However the path modules is using windows style slashes as the route is being generated on a windows machine.

Since the generated route is different than the included one, it actually gets added; where as normally it would see it as a duplicate and skip the insertion.

@kingcody
Copy link
Member

@stuarthallows I've submitted two patches (#1206, #1214) to the canary branch 3.0.0-rc5 that should address the issues here. Would you mind testing those and confirm whether or not they do indeed solve your issues?

@Awk34
Copy link
Member

Awk34 commented Aug 29, 2015

As Cody mentioned, those patches should fix your problems. Re-open if they persist.

@Awk34 Awk34 closed this as completed Aug 29, 2015
@Awk34 Awk34 added the bug label Aug 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants