Submodule 23.3: Sending data to the server
The results
With the previous code configured, open your Terminal, go to the jsonServer
sub-folder and run json-server --watch db.json -d 2000
. This will introduce a delay of 2 seconds before the server sends the reply for the request. The server will serve the db.json file for your application. You can watch the server in your browser URL localhost:3000
Open another Terminal window, go to the angularChocoYourname
angular-sub-folder and run ng serve
to run your application in development mode. In your browser navigate to the URL localhost:4200
The contact page has been server by the json-server.
We have stored the data in the db.json file and we can access these every time!
Do a Git commit with the message "Angular storing data".