Wie kriege ich diese Restful api auf meinen apache webserver?
Hallo!
Ich habe eine Restful api mit node.js programmiert ich habe folgendes benutzt:
Express und sqlite3.
Nun möchte ich wissen wie genau ich diese API auf meinem apache webserver zum laufen bringen kann. Ich bin schon googeln gegangen und ich habe nur heraus gefunden, dass ich nodejs express und sqlite3 irgendwie auf meinem webserver zum laufen bringen muss wie das geht habe ich keine Ahnung, deswegen bin ich hier gelandet und hoffe sehr das mir jemand behilflich sein kann.
Schonmal danke im voraus
A node.js application must also be started on a node-enabled web server.
Apache can only run PHP. (There are attempts to start node.js server via PHP, but this is not recommended.)
Heroku or Vercel offer (in dimensions) free node.js hosting.
If it’s just about your local computer and not about availability on the Internet, you can easily start a node server via the command line or via a corresponding command in the package.json.
so the api must be available for all in my network
As long as it doesn’t have to be accessible on the Internet, it’s enough to start the API locally on your PC.
Do not let the PC turn off 😁
Nee, in your network, everyone can access the network-internal IP of your computer and the port that the app is looking for when starting itself.
Example: You start the server
then comes in the console
Then, within your network, everyone can access the API with the IP of your computer (e.g. 192.168.178.27, you have to look into the network properties on your computer).
Address would then be in the example 192.168.178.27:3000
but if I don’t make the api on a webserver only I can access and not the people in my network
If it’s a pure WebSpace, then not at all if it’s not designed for it.
If it’s a server, you’ll need to make more information on what a server is.
it is a windows webserver that is hosted locally on my pc but it is also accessible with this link: http://meineip:8080
with myip I mean of course my ip
it is version 2.4 of apache webservers and it is not a pure webspace but a server
In this case, you host this via node and not via apache. https://nodejs.org/en
Yes I know api is the interface between two applications and I am no longer sure but rest api is an api that communicates with http requirements if I am not mistaken.
Website, app, program … Do you even know what an API / ReST API is?
and how will someone access the api?
Release port in your local firewall. That’s all. Then the other one with the port on it. Since your Apache already listens to 80, you should choose another
Yes, she does, however, how can I make this API accessible to all people in my network?
As already said, you host JavaScript with NodeJS and not with Apache. I can repeat myself every time or you accept it. You need a JavaScript that can host and then you start it with NodeJS. Since you say you already have a RestAPI and want to host it, I assume that it works as soon as you start it with Node
yes but I want to install node on the apache webserver that the api must be accessible to all people in my network and not just for me