0

I use Visual Studio 2013 and I have installed the Node Tools for Visual Studio.

I have also reviewed this question here at How to mix Node.js and Typescript in the same Visual Studio project?

The issue I am facing is that I am stuck trying to figure out how to set up the project.

On the examples and books I have read, what they do, is basically just put everything into a chat folder with a server.js and index.js file and then run the server and then navigate to the page.

I understand this process. I think I could even perhaps work out some hand rolled process with grunt.

But I want to use visual studio but both of my plans for doing so are blocked.

  1. You cannot have a TypeScript project with both AMD and CommonJS module systems in it. This makes sense.
  2. You can create chat solution with client and server but now you have disconnected one from the other in an awkward way. Running my client depends on the server running and hosting my client! This is just weird so I guess it is wrong.

Can someone take the time to clear this up for me? How would YOU structure a Chat application in Visual Studio in TypeScript?

Thanks for reading!

Community
  • 1
  • 1
Clark
  • 2,598
  • 3
  • 27
  • 41
  • 1
    I think I could even perhaps work out some hand rolled process with grunt. Already did that : https://github.com/basarat/demo-fullstack – basarat Jan 15 '15 at 00:02
  • 1
    `How would YOU structure a Chat application in Visual Studio in TypeScript` I wouldn't. Just leave the compile to `grunt`. FYI: I have implemented a reliable TypeScript project spec that does support it. https://github.com/TypeStrong/tsproj I need to work on a language service that uses it though : https://github.com/typestrong/tscs and then comes the IDE https://github.com/TypeStrong/atom-typescript/ – basarat Jan 15 '15 at 00:13
  • I have woken up a little depressed by this. Whereas I am down with TypeScript and I am happy to maintain definitions, and jump through some hoops. I cannot get rid of my IDE and deal with the cognitive load of a whole new setup. – Clark Jan 15 '15 at 09:14
  • 1
    Do you think that this is just a temporary problem relating to Visual Studio + TypeScript? Or quite simply, by design, will never work? PS. I am actually reading your book! Nice one bas! – Clark Jan 15 '15 at 09:16
  • You seem to want to combine "development" and "deployment". Visual Studio is for development. You should be using mocks for both your client and server projects (2 separate projects) when developing one or the other. The more you keep your projects separate during development, the more robust your total solution will be. Because in the end each piece needs to function flawlessly even if the other side is down. – John Pankowicz Jan 15 '15 at 22:34
  • 1
    @Clark thanks for the kind words. for `Do you think that this is just a temporary problem relating to Visual Studio + TypeScript` I think its always going to be a problem. TypeScript just has soo much code reuse e.g throw Test config into the mix so now you have Server+Client+Test compile targets for the *same code*. VS is just not designed for this workflow at the moment. – basarat Jan 15 '15 at 23:55
  • You may be right John. The confusion for me is I see no difference. The back end of the chat room is also the server which in turn hosts the front end. Examples in some books essentially start the server, and then run the webpage (which in turn serves the client files). I see no way to replicate this or alternatives to this so it leaves me stuck. Thanks Basarat I see your point. – Clark Jan 16 '15 at 00:07
  • 1
    The client of course gets its code from the server. But once it has the code, it operates on its own time line. It could be still running its code when the server is down. Just as the server could still be running with no clients connected. By putting the two into the same project, you are connecting the two together time-wise. They will always start in the same sequence. Once your code is running in the real world, clients can start at any time irregardless of the server's state. Then you will have bugs caused by race conditions that you avoided by artificially connecting the processes. – John Pankowicz Jan 17 '15 at 04:29
  • Thank you John! I think I have a direction now. – Clark Jan 17 '15 at 19:56

0 Answers0