N
N
neodekvat092015-09-14 20:57:20
JavaScript
neodekvat09, 2015-09-14 20:57:20

What is the best way to add / supplement the chat?

Hello, not so long ago I started writing, and generally studying javascript (a year has not passed yet, respectively, there is every reason to call me a shitcoder, which I am, in fact, something), sort of got used to it, switched to node.js (according to -mostly because of the mainstream, and I don’t want to learn another server language (although I know php)).
And I decided to write a chat (quite simple, sort of) on socket.io. It seems like everything works out, but it’s quite difficult, there are a couple of problems that I’m trying to solve, but rather not problems, but simply from lack of experience:
I use jQuery for simplicity / convenience in the code (banal, only selectors), and because of this, the abundance of code starts to annoy (in html, similarly), I already stop orienting myself, and in order to change something - it's not very simple / fast. I came to the conclusion (possibly wrong) to connect and switch to a template engine, but I don’t know which one, and how to really use it (of course, I honored a little about handlebars, mustache, hogan), but nevertheless, this is absolutely new for me.
There is a wild desire to bring the chat to a more or less production state, the idea is simple: A chat in which you enter a nickname at the entrance, then choose a room (minimum 2 people, and the idea itself is only for 2), chat there. Just go out / create / delete rooms, and that's it, I would first do this. Now it’s just stupid problems, for example, it’s impossible to display a list of rooms, update them when the user connects / disconnects, I just get confused in the code.
And... for the most part I'm writing here for you to give some advice, criticism, anything that can help, I'm still a very green coder, which is why I ask you to be a little more subjective ^^
If you can, write something like advice etc. I will be very glad to any instruction/criticism, etc.
I'm extremely ashamed to look at my code, but for clarityit's on github

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
amatory10, 2015-09-16
@amatory10

There is no need to be ashamed of the code if enough attention is paid to it, in any case, a good decision does not come immediately, difficulties arise and are successfully resolved.
Regarding the advice, you need to get used to the strict organization of the code, i.e. do not throw everything into one heap, but structurally distribute it based on the application logic. Let's say css, js, html in separate folders, they have nothing to do next to the server code, i.e. separation of client and server.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question