• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[node.js] Application with various tools

Shikate

Pixel Artist since 2011
Joined
Mar 30, 2011
Messages
404
Reaction score
838
Location
Poland
Hi, I'd like to show you my application. I'm writing it in node.js, so it's something new and fresh compared to php/apache etc. Currently app doesn't provide many features but I've got lots of ideas and I'm trying to improve it every day. I decided to start project to learn more about new trends, technologies and to create something useful. Full application code is available at GitHub. Everyone can download and test this application, but you need node.js installed and it's not user friendly. I may host this in the future as long as I have memsoria.pl but at this moment I'm focused to make application better.

Screenshots(sorry for frames etc., it's just easier to post it like that):
a) Port 3000(application runs on two ports atm)
- Home
6bw7sz9.png


- Get Server Status
f8lWNn4.png

b) Port 7777
- Home
JpDh346.png


- Get Online Players List
NK8ShRp.png


I'm open to any suggestions, ideas, criticism etc. Have a nice day.
 
Very good my friend, nodejs is very powerful.
I'll try it later on my dev enviroment and give you a feedback.
 
It's a nice application but you should use Angular with Node. But it's a good start overall, finally someone tried to learn something new. The next step is to transform that to a Angular + Node for sure!
 
PHP was the worst choice, eew.
I have plans to rewrite AAC to NodeJS, Elixir or Haskell, but obviously not as a customizable framework, only for my needs to avoid useless CPU usage.
 
@G4BB3R
Writing an AAC in NodeJS is not the best idea. First, NodeJS is by design single-threaded, which means you will end up having the same problem that TFS now has - scalability. The idea of running a process farm in order to get around this issue does more harm than good.

Secondly, handling MySQL in NodeJS is not a pleasant thing (and when you work with TFS, you need to use MySQL). NodeJS likes MongoDB, not MySQL.

While PHP is not the best language by design, it scales damn well and can be optimized properly.
 
Last edited:
@G4BB3R
Writing an AAC in NodeJS is not the best idea. First, NodeJS is by design single-threaded, which means you will end up having the same problem that TFS now has - scalability. The idea of running a process farm in order to get around this issue does more harm than good.
Secondly, handling MySQL in NodeJS is not a pleasant thing (and when you work with TFS, you need to use MySQL). NodeJS likes MongoDB, not MySQL.
While PHP is not the best language by design, it scales damn well and can be optimized properly.

Actually NodeJS has nice MySQL drivers to work async as good as MongoDB.
One good example: https://github.com/felixge/node-mysql/

But Node is not my main choice, I will try Elixir (from Erlang VM) and Haskell prototypes first, because functional programming is the future :)
 
But Node is not my main choice, I will try Elixir (from Erlang VM) and Haskell prototypes first, because functional programming is the future :)
That's actually ironic. Few years back, you'd see everybody saying "Object-oriented programming is the future".
 
It's so beutiful to see 2 differeent good AAC devolpers in one thread. ^^
 
PHP was the worst choice, eew.
I have plans to rewrite AAC to NodeJS, Elixir or Haskell, but obviously not as a customizable framework, only for my needs to avoid useless CPU usage.
Haskell or Elixir would be AMAZING, but heck, nobody would be able to edit the code kek

FP FTW
 
That's actually ironic. Few years back, you'd see everybody saying "Object-oriented programming is the future".
OO is a 70's concept but only got popular in 90's. Nowadays I can't imagine myself coding imperative instead OO.
But years pass and new technologies are created to replace the old ones, and Functional Programming is growing exponentially in the last years.
 
@G4BB3R
Writing an AAC in NodeJS is not the best idea. First, NodeJS is by design single-threaded, which means you will end up having the same problem that TFS now has - scalability. The idea of running a process farm in order to get around this issue does more harm than good.

Secondly, handling MySQL in NodeJS is not a pleasant thing (and when you work with TFS, you need to use MySQL). NodeJS likes MongoDB, not MySQL.

While PHP is not the best language by design, it scales damn well and can be optimized properly.

You couldn't be more wrong. The asynchronously of NodeJS is what makes it such a good fit for a web server.
Yes it's single-threaded, but it's meant to run in a cluster for scaling. NodeJS is much more efficient than PHP, and scales far better.
I created a full AAC in Node.JS and it performed great.

I've worked with NodeJS on the enterprise level, and I would never go back to PHP or Apache.
I don't know what you mean by "does more harm than good". NodeJS is meant to cluster. https://nodejs.org/api/cluster.html

There are no negative affects to clustering as long as you develop your app properly.
It is amazing to be able to spin up a new dedicated server and run a node process for each core on the server.
Every process on the core is running asynchronously on it's own thread. They can each handle multiple requests from a connection at once.


Node.JS != TFS
 
I also forgot to note. Working with MySQL (MariaDB in my case) was very pleasant. I used a very nice ORM called Sequelize. I finished the AAC with it and had no complaints. Modeling, validation, querying was all pleasant.
 
@Syntax I'm not saying it's impossible to write an HTTP application that scales. However, the main difference between PHP and NodeJS is that PHP has a lifetime of a request (even with FPM) and therefore is volatile. It doesn't mean it's good or bad - it certainly doesn't allow for any background features like NodeJS does. The fact that you can run stuff in background, not tied to any request is great in NodeJS. There is also other features - most important is probably websocket connections. Now that you have all those goodies, try scaling NodeJS. Load balance websocket connections without breaking them? Synchronize state of threads? Not that easy anymore.
 
@Syntax I'm not saying it's impossible to write an HTTP application that scales. However, the main difference between PHP and NodeJS is that PHP has a lifetime of a request (even with FPM) and therefore is volatile. It doesn't mean it's good or bad - it certainly doesn't allow for any background features like NodeJS does. The fact that you can run stuff in background, not tied to any request is great in NodeJS. There is also other features - most important is probably websocket connections. Now that you have all those goodies, try scaling NodeJS. Load balance websocket connections without breaking them? Synchronize state of threads? Not that easy anymore.
I've scaled NodeJS, I do it everyday. It's really easy. Use a sticky load balancer (I prefer nginx, but HAProxy works too, the Cluster module with a sticky plugin works as well).
You don't need to synchronize threads when everything is event driven.

I generally spin up one Node process for each core on the machine, I've never ran into any faults or anything that was more difficult than it should have been.
NodeJS scales horizontally and vertically very well.
 
I've scaled NodeJS, I do it everyday. It's really easy. Use a sticky load balancer (I prefer nginx, but HAProxy works too, the Cluster module with a sticky plugin works as well).
You don't need to synchronize threads when everything is event driven.

I generally spin up one Node process for each core on the machine, I've never ran into any faults or anything that was more difficult than it should have been.
NodeJS scales horizontally and vertically very well.

I like how you do that and you are right - it can be done. There's lots of big companies scaling large NodeJS apps.

What I was focusing on in my argument is that to do it properly, you need a lot of moving pieces and a lot of configuration. You need to know how to configure nginx (which I love, btw), make it sticky and synchronize nodejs threads if you go crazy and make your application awesome with sessions states. In my opinion, it's way too much for an average or even experienced OTS sysadmin. I was hoping my AAC gets used by more than just me, so I chose for it be deployed a little more easily.
 
Exactly just OpenTibia . Everyone likes something else ; )
 
Back
Top