# Sample Dual-Endpoint Web Application (Dashboard + API)

- Link: https://www.agilicus.com/anyx-guide/sample-dual-endpoint-web-application-dashboard-api/
- Published: 2024-05-14T00:25:47+00:00
- Author: Don Bowman

1. [Home](https://www.agilicus.com/)
 2. Sample Dual-Endpoint Web Application (Dashboard + API)

![98208b64-messaging](https://www.agilicus.com/www/98208b64-messaging.svg)

Sample

---

## Dual-Endpoint Web Application (Dashboard + API)

A single web application with two unique API endpoints, with appropriate tokens 
to secure them.

[CONTACT](https://www.agilicus.com/contact-us/)

## Overview

See the companion code in [Github](https://github.com/Agilicus/flask-example). This
can be run with `docker-compose up` to demonstrate.

In this example, we have an HTML web dashboard (running on localhost:5000), and 
an API (running pn localhost:5001). We use the Web Application Firewall rewrite 
to remap the API to a prefix (so it will become conceptually localhost:5000/api).
This allows it to be represented as a single-sign-on session, on a single external
URL.

In this example, we first create an application. On the 3rd step, “My Application
Is An API”… if your API correctly uses [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS),
you can leave this as-is. Else consider setting it, or example the ‘Define’ step
later for more configuration.

When you get to step 7 (Configure Upstream Services), enter 1 for each endpoint.
The main (HTML) one is ‘application’, the others are path_prefix. Substitute the
real hostname if you need (you may need additional remapping later if your application
is hard-coded).

Once you have completed the New Application Stepper, navigate to the ‘Define’ screen
to refine the setup. On the ‘Proxy’ Tab, enable ‘Rewrite Common Media Types’.

Add permission to your user, and the page should work at https://<name><domain>/

[⌊9acd6364-p1⌉⌊9acd6364-p1⌉[

[⌊p2⌉⌊p2⌉[

[⌊p3⌉⌊p3⌉[

[⌊p5⌉⌊p5⌉[

[⌊p6⌉⌊p6⌉[

[⌊p7⌉⌊p7⌉[

[⌊p8⌉⌊p8⌉[

[⌊p10⌉⌊p10⌉[

[⌊p11⌉⌊p11⌉[

[⌊p12⌉⌊p12⌉[

[⌊p13⌉⌊p13⌉[
