1e time in your 1e terminal: npm install
2e time or else: npm run dev
To run the virtual server in your 2e terminal use: json-server events.json
**** Please make sure your events.json file is located on your desktop or somewhere else, but not in your "starter" folder....! Otherwise you get an loop ******
Having problems to starting up the server:
Install json-server globally using npm: If you haven't installed json-server yet, you can do so globally using npm (Node Package Manager). Open your terminal (PowerShell) and run the following command:
Copy code:
npm install -g json-server
This command will install json-server globally on your system, making it available as a command-line tool.
Verify Installation: After installation, verify if json-server is correctly installed by running the following command:
css
Copy code:
json-server --version
Still having problems? Then see under here:
Open PowerShell as Administrator: Right-click on the PowerShell icon and choose "Run as administrator" to ensure you have the necessary permissions to modify the execution policy.
Set Execution Policy: Run the following command to set the execution policy to allow script execution:
powershell
Copy code:
Set-ExecutionPolicy RemoteSigned
This command sets the execution policy to RemoteSigned, which allows you to run scripts that you've written yourself without needing them to be digitally signed. You might need to confirm the change by typing "Y" and pressing Enter.
Verify Execution Policy: You can verify that the execution policy has been set correctly by running:
powershell
Copy code:
Get-ExecutionPolicy
It should return "RemoteSigned".
Try Running json-server Again: After adjusting the execution policy, try running the json-server command again:
powershell
Copy code:
json-server --version
This time, it should execute without encountering the previous error.
Thanks and credits to WincAcademy in Amsterdam, The Netherlands!