{"action":"created","issue":{"url":"https://api.github.com/repos/labstack/echo/issues/367","repository_url":"https://api.github.com/repos/labstack/echo","labels_url":"https://api.github.com/repos/labstack/echo/issues/367/labels{/name}","comments_url":"https://api.github.com/repos/labstack/echo/issues/367/comments","events_url":"https://api.github.com/repos/labstack/echo/issues/367/events","html_url":"https://github.com/labstack/echo/issues/367","id":135029968,"number":367,"title":"Referenced file routing scheme","user":{"login":"pandex","id":12764068,"avatar_url":"https://avatars.githubusercontent.com/u/12764068?v=3","gravatar_id":"","url":"https://api.github.com/users/pandex","html_url":"https://github.com/pandex","followers_url":"https://api.github.com/users/pandex/followers","following_url":"https://api.github.com/users/pandex/following{/other_user}","gists_url":"https://api.github.com/users/pandex/gists{/gist_id}","starred_url":"https://api.github.com/users/pandex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pandex/subscriptions","organizations_url":"https://api.github.com/users/pandex/orgs","repos_url":"https://api.github.com/users/pandex/repos","events_url":"https://api.github.com/users/pandex/events{/privacy}","received_events_url":"https://api.github.com/users/pandex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-02-20T04:02:30Z","updated_at":"2016-02-21T04:07:01Z","closed_at":null,"body":"I have a page that makes a simple ajax call:\r\n\r\n     e.Get(\"/abc/:x\", myFunc) // x is a long random alphanum \r\n     . . .  // other routes\r\n     e.Static(\"/img/*\", baseDir+\"/img/\") // for all image files\r\n     e.Static(\"/\", baseDir)\r\n     e.Run(\":8005\")\r\n\r\necho catches  **/abc** fine and I get to myFunc to extract and process x:\r\n\r\n     x := c.P(0)\r\n     . . . // do some process\r\n     return c.File(baseDir+\"myReturnX.html\", \"\", false)\r\n\r\nmyReturnX.html contains referenced files in the head: \r\n\r\n     myScript.js\r\n     myStyle.css\r\n     jquery.min.js@SomeCdnUrl\r\n     . . .\r\n\r\nPROBLEM: Since I don't always know the exact list of files to be referenced by myReturnX.html, \r\nI can't really do a **switch** case for specific routing options. So when those referenced files come back as requests:\r\n\r\n\t/abc/myScript.js\r\n\t/abc/myStyle.css\r\n\t/abc/jquery.min.js@SomeCdnUrl\r\n\t. . .\r\nI get 404s.\r\n\r\nWhat would be the **e.Static()** or **e.Get()** lines that can **generically** serve those referenced files from the first returned file myReturnX.html? \r\n\r\n\r\n\t\r\n\t"},"comment":{"url":"https://api.github.com/repos/labstack/echo/issues/comments/186737192","html_url":"https://github.com/labstack/echo/issues/367#issuecomment-186737192","issue_url":"https://api.github.com/repos/labstack/echo/issues/367","id":186737192,"user":{"login":"vishr","id":314036,"avatar_url":"https://avatars.githubusercontent.com/u/314036?v=3","gravatar_id":"","url":"https://api.github.com/users/vishr","html_url":"https://github.com/vishr","followers_url":"https://api.github.com/users/vishr/followers","following_url":"https://api.github.com/users/vishr/following{/other_user}","gists_url":"https://api.github.com/users/vishr/gists{/gist_id}","starred_url":"https://api.github.com/users/vishr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vishr/subscriptions","organizations_url":"https://api.github.com/users/vishr/orgs","repos_url":"https://api.github.com/users/vishr/repos","events_url":"https://api.github.com/users/vishr/events{/privacy}","received_events_url":"https://api.github.com/users/vishr/received_events","type":"User","site_admin":false},"created_at":"2016-02-21T04:07:01Z","updated_at":"2016-02-21T04:07:01Z","body":"What you are doing in switch statement is done by `Echo#Static` function.  `e.Static(\"/\", baseDir)`  should deliver html and other static files without any extra code from root path `/`.  You don't need extra `*` for images, it should be `e.Static(\"/img/\", baseDir+\"/img/\")`"}}