CD to the new downloaded directory (ex: cd C:\webapi\fivem-webapi
Excecute the install command: npm install
ONLY BECAUSE THE DOWNLOAD IS CURRENTLY BROKEN Rename packages.json to package.json
Edit the app.js with your favorite text editor with the correct variables.
Open the port you used in the variables section. To open a port easily, use the batch file below.
Variables (Bold Indicates do not edit):
In the CMD prompt execute the following command: node app.js
server_dir: The server MAIN directory. EX: C:\Users\Administrator\Desktop\Server-1 var server_file: server.bat
key: Your secret password. Only give this out to people who you want to have access.
Security Notes:
It is recommended to change regularly. I recommend using a password generator and not even giving out the key, but embedding it in a secure part of your website. Staff can still get access to the key through Inspector, but it makes it more secure.
Port: the port you want the webclient to run off of. 82 will suffice for most people.
Allow port 82 (Just run it :D) Allow Ports.bat (455 Bytes)
Now, @kloentje2 for the bad part. While doing this, I still couldn’t get it to work. Maybe I messed up? I’m not sure.
Adding a secret key to a hidden part of the source code is the best thing to do to make it secure? Why not hide all access to this API to a specific page that only staff members can make? Even just behind a simple http basic auth with brute Force protection
So this was working for about 30 minutes then i tried to click start and it gave me this error
Error
C:/webapi>node app.js
Running on port 82
{ Error: Command failed: cd C:UsersAdministratorDesktoppserver1 && start ser
ver.bat
The system cannot find the path specified.
at ChildProcess.exithandler (child_process.js:275:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)