johnpapa / lite-server

Lightweight node server
MIT License
2.32k stars 269 forks source link

Multiple baseDir's to support multi-language app #141

Open MickL opened 6 years ago

MickL commented 6 years ago

A descriptive title

An (aot) Angular application currently needs to build each language seperate:

dist/index.html // Detect language and redirect to /en or /de
dist/en/index.html // BaseDir app in english
dist/de/index.html // BaseDir app in german

So the desired functionality would be:

http://localhost:3000/ -> dist/index.html

http://localhost:3000/en -> dist/en/index.html
http://localhost:3000/en/some/fancy/route -> dist/en/index.html
http://localhost:3000/en/styles.css -> dist/en/styles.css

http://localhost:3000/de -> dist/de/index.html

But how to archieve this? Is it possible by use of a custom middleware? Or is this not possible with lite-server? Normally i would add a htaccess in dist/, dist/en/ and dist/de/.