I recently got into website development and am in the process of making my first website using Angular 2 right now. I already created websites in the past using basic HTML and PHP but that was nothing special and the quality of code was pretty low. "Back in the days" I just created different files for different tasks, e.g. login, creating a comment and so on. Nowaydays this kind of practices seems kinda clumsy.
Now, I read about REST APIs and from my understanding this is what I am going to need to have a clean way to let my frontend communicate with my backend. Basically from my understanding I am going to have an application which purpose is to communicate with my database as soon as my frontend sends a request to it - Right? So what I am going to do is to create an API which fits my needs. Is it possible to have my frontend and my backend-database-API-thing on one server?
Moreover, I got into NodeJS because NodeJS seems exactly like what I need here. However, is it correct that I need a special server which actually supports to let me run NodeJS applications? If yes, what are my alternatives? I don't want to switch providers right now. I saw that it is possible to create an REST API using PHP - Is that common? Is that "good practice"? Or is that some old ass workaround which should not be used anymore?
I am grateful for any kind of input. I feel kinda lost right now with what to pick up for which task.