# Default route to serve index.html if nothing else matches

**URL:** <https://softwaremill.community/t/default-route-to-serve-index-html-if-nothing-else-matches/215>\
**Category:** tapir\
**Created:** [May 31, 2023, 7:00pm UTC](https://softwaremill.community/t/default-route-to-serve-index-html-if-nothing-else-matches/215 "2023-05-31T19:00:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![null-nor-void](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/null-nor-void/32/149_2.png) [@null-nor-void](https://softwaremill.community/u/null-nor-void)\
**Post date:** [May 31, 2023, 7:00pm UTC](https://softwaremill.community/t/default-route-to-serve-index-html-if-nothing-else-matches/215/1 "2023-05-31T19:00:05Z")

</div>

What we need to do is serve index.html whenever the route is one that isn’t recognized by any of the other endpoints. Is there a way to do this?

(Specifically, we are using an Angular front end, and we need to redirect the user back into the front end if they enter a route that the front end doesn’t capture (see [Angular](https://angular.io/guide/deployment#fallback-configuration-examples)). We’re using zio-http as the http server).

---

<div class="post-metadata">

**Author:** ![adamw](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/adamw/32/28_2.png) [@adamw](https://softwaremill.community/u/adamw)\
**Post date:** [June 7, 2023, 6:25am UTC](https://softwaremill.community/t/default-route-to-serve-index-html-if-nothing-else-matches/215/2 "2023-06-07T06:25:45Z")

</div>

Sorry, somehow this got flagged as spam - do you still have this problem?

---

<div class="post-metadata">

**Author:** ![null-nor-void](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/null-nor-void/32/149_2.png) [@null-nor-void](https://softwaremill.community/u/null-nor-void)\
**Post date:** [June 7, 2023, 12:32pm UTC](https://softwaremill.community/t/default-route-to-serve-index-html-if-nothing-else-matches/215/3 "2023-06-07T12:32:11Z")

</div>

Hi Adam. Yes, we haven’t been able to figure out how to do this.

---

<div class="post-metadata">

**Author:** ![adamw](https://dub1.discourse-cdn.com/flex005/user_avatar/softwaremill.community/adamw/32/28_2.png) [@adamw](https://softwaremill.community/u/adamw)\
**Post date:** [June 7, 2023, 8:00pm UTC](https://softwaremill.community/t/default-route-to-serve-index-html-if-nothing-else-matches/215/4 "2023-06-07T20:00:38Z")

</div>

Would having an endpoint such as this:

```plaintext
endpoint.get.out(stringBody).serverLogic(_ => Right("<html>Hello, world</html>"))

```

work? You’d need to add the endpoint to the end of your endpoint list. Alternatively, you can define a path prefix which has to match:

```plaintext
endpoint.get.in("a"/"b").in(paths).out(stringBody).serverLogic(_ => Right("<html>Hello, world</html>"))

```
