Difficulty with absolute and relative paths in Express

后端 未结 5 672
挽巷
挽巷 2021-01-24 17:59

I have a route for an API in an Express app that looks like this:

app.get(\'/:username/:bookmark/\', function(req, res) {

  // do stuff

})

As

5条回答
  •  伪装坚强ぢ
    2021-01-24 18:28

    solution source: https://github.com/mongo-express/mongo-express/pull/205

    I try and it work, just add "/" before the link, example:

    you are in localhost:8080/courses/ and your href is: href="style/style.css" you will lead to localhost:8080/courses/style/style.css.

    solution is add"/" before, example: href="/style/style.css" it will start from root " localhost:8080/style/style.css"

提交回复
热议问题