Difficulty with absolute and relative paths in Express

后端 未结 5 666
挽巷
挽巷 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:37

    Here's a concrete example, take the typical use-case of serving files in ./public using the express.static() middleware:

    app.use(express.static(__dirname + '/public'));

提交回复
热议问题