leeluolee / puer

more than a live-reload server, built for efficient front-end development
https://github.com/leeluolee/puer
1.21k stars 102 forks source link

How about mod rewrite? #17

Open ghost opened 9 years ago

ghost commented 9 years ago

In case I have a file called app/index.html to start the app, given that I am using html5mode in angularjs, how can I access the site directly using localhost:8000 instead of localhost:8000/app/index.html?

Please help and thanks!

leeluolee commented 9 years ago

I also consider the mod rewirte is useful.

I guess you may need this .

where in route.js

   module.exports = {
       "GET /**": "app/index.html"
   }

then

puer -a ./route.js
leeluolee commented 9 years ago

Maybe today , I will update the puer to implement the simple static mod rewrite

ghost commented 9 years ago

It shows this when I use "GET /**": "app/index.html"

.get() requires callback functions but got a [object String]

leeluolee commented 9 years ago

@yhjor1212 because, it hasn't been implemented yet . :)

I push the commit to github right now , but haven't release it to npm. you can npm install it through github temporarily

npm install leeluolee/puer -g

the code

module.exports = {
       "GET /**": "app/index.html"
   }

will make the all path begin with '/' point to the app/index.html file. which can make your angularjs app works on html5mode .

ghost commented 9 years ago

The error message indeed disappeared, but the reload still doesn't work:

access http://localhost:5000/pending1 get: Cannot GET /pending1

leeluolee commented 9 years ago

maybe you should show your configuration , so I can track the issue easily . @yhjor1212

ghost commented 9 years ago

$locationProvider.html5Mode(true);