<commit_before>ng-html5mode-serve
==================

Hey. When you guys find the thing that already does this, preferably in Grunt, will you tell me? kthxbye.<commit_msg>Add simple README that shows how to configure.<commit_after>ng-html5mode-serve
==================

Hey. When you guys find the thing that already does this, preferably in Grunt, will you tell me? kthxbye.

What this does
--------------

So, you're serving an Angular app at `http://ngexampleapp.com/`, aka index.html.
If we want simple static serving to work with routes (like `/dashboard`), we have to accept non-HTML5 mode URLs `http://ngexampleapp.com/#/dashboard`.
And that's garbage.

We need a server that will respond to URLs like `http://ngexampleapp.com/dashboard` with index.html. Then our app could take over and take us to the right view.
But we also need to serve some paths (like `/styles/` and `/scripts/`) with their real files: not index.html.

This server takes a configuration that tells it what port to serve on and what routes to serve real files for. It will serve index.html for everything else.

Example Config
--------------

```
{
    "port": 4000,
    "file_paths": ["bower_components", "styles", "scripts", "views"]
 }
```

#### Example routes from config

| Path                             | File served                                            |
|----------------------------------|--------------------------------------------------------|
| /                                | index.html                                             |
| /styles/main.css                 | styles/main.css                                        |
| /scripts/controllers/app.js      | scripts/controllers/app.js                             |
| /dashboard                       | index.html                                             |
| /experimental-dev-path           | index.html                                             |

See how nice that is?

It's written in Go, which is because I wanted something in 20 minutes and didn't know node yet. Hidden benefit: automatically sends correct `Content-Type` with the files via file extention or automatic content type detection.
{'fraction_non_alphanumeric': 0.14563106796116504, 'fraction_numerical': 0.004160887656033287, 'mean_word_length': 1.691542288557214, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6997654', 'n_tokens_mistral': 513, 'n_tokens_neox': 490, 'n_words': 219}