R
R
Rag'n' Code Man2020-07-14 06:23:27
Game development
Rag'n' Code Man, 2020-07-14 06:23:27

What are the differences between NodeJS server and LAMP?

At the moment I am developing a game in which a certain amount of data needs to be stored on the server. Initially, I was going to use the LAMP stack for my purposes, but then I thought that I would rather use JavaScript, i.e. NodeJS, as I programmed in JS for more than a year, and in PHP for 1 week, and then I abandoned this idea (not because the PL is bad, but I just lost my enthusiasm for learning it). However, I managed to deploy a local server, and even made a couple of AJAX requests to it, but I haven’t worked on NodeJS yet, now I’m studying it and some questions have already appeared.

In PHP, everything is simple, you just make a request to a PHP file and get a response, but with NodeJS everything is more complicated. First, I write node filename.js in the console, it starts the server on some port, and I already start getting the results of executing the code, but do I have to do the same on VDS? Those. I write somewhere in the console of the admin panel of my server node filename.js and the server will work around the clock and return a response when requested on a certain path? (i.e. if the game made a request, say to mysite.com/getHello, then the application will receive the string "Hello, World" in response).

And it turns out that since the server will be without a LAMP stack, then I lose the ability to configure via .htaccess?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Khegay, 2020-07-14
@iDmitriyWinX

Here, the approach to development and deployment needs to be explained a bit:
LAMP is a stack of technologies: Linux, Apache, MySQL, PHP.
node.js is a technology.
In order for a remote server to communicate with the outside world, web servers are used: nginx / Apache / IIS, etc. Further requests pass to a programming language. It is best to use frameworks. And then, requests are processed (requests are made to the database, communication with the file system, etc.).
If you say that it is more convenient for you to work with JS, then I advise you this approach:

  • Virtualbox virtual machine . The virtual machine is needed in order to create approximately the same environment as on the server, and also in order to separate the execution of code from your system into a separate environment.
  • Vagrant is such an add-on for virtual machines. Boxes containing everything for the VM.
  • As OS - Linux Ubuntu (18.04 or 20.04)
  • nginx as a web server, it is also like a reverse proxy
  • nvm in the form of a node.js version manager, with nvm you can install the desired versions of node.js and npm
  • MongoDB as a database. Or MariaDB if you need a SQL-like database
  • express.js as a web framework that will work with databases, files, and more
  • If you need a visual admin panel, then it is better to take one of the mainstream frameworks: Angular / Vue / Reqct

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question