how to deploy mock json data api's(json-server) and angular 17 application in apache tomcat server 9 version

27 Views Asked by At

How do I deploy a mock json data(json-server) Api's along with Angular 17 application in an apache tomcat 9 server?

  1. I need to deploy an Angular 17 application.
  2. I also want to run a mock json data(json-server) created in that angular application which I used for crud operations.
  3. Where I need the json database to run automatically while running the server.
  4. I have installed Apache Tomcat server and I need to deploy the above requirements.

I have tried the endpointsin my package.json, and want it to run automatically in a script but it does not work properly.

1

There are 1 best solutions below

0
Rettagunta Deepak On

For example:-

Step 1:- npm install -g concurrently

Step 2:- add the following into the package.json file:

"scripts": {
    "ng": "ng",
    "start": "concurrently \"ng serve --open\" \"json-server --watch ./request-from-site-DB.json -p 3200\" \"json-server --watch ./port-manager-DB.json -p 3300\"",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    }

step 3:- npm start

This will run both angular application and json database automatically at a time and deploy it in your server.