Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining AngularJS, HTML5 locations and superstatic

I've been using the nodejs http-server to serve up my Angular app, but it doesn't work well with HTML5 locations, because using them requires the server to redirect, and http-server doesn't do that. So I saw a recommendation to try superstatic, and installed it. Then I set up the following superstatic.json file:

{
  "routes": {
    "Admin/**":"/index.html",
    "Give/**":"/index.html",
    "Pending/**":"/index.html",
    "Store/**":"/index.html"
  }
}

I launched it with

superstatic --config superstatic.json

While it correctly serves up my app if I start at "/", reloads load the index.html file, but do not do any of the angular processing of the file.

Has anyone successfully used superstatic with angular?

like image 806
Greg Dougherty Avatar asked Mar 18 '23 01:03

Greg Dougherty


1 Answers

I got mine perfectly working by setting my superstatic.json like this:

{
  "rewrites": [
    {"source":"/**","destination":"/index.html"}
  ]
}

Then run it with

superstatic --config superstatic.json
like image 112
Louie Almeda Avatar answered Mar 29 '23 06:03

Louie Almeda