internetarchive / dweb-archivecontroller

GNU Affero General Public License v3.0
7 stars 2 forks source link

Routing: Add regexp #12

Open mitra42 opened 4 years ago

mitra42 commented 4 years ago

Add regexp support in routing.js so can support download/IDENTIFIER/IDENTIFIER_archive.torrent to the dweb-torrent microservice. (was part of https://github.com/internetarchive/dweb-mirror/issues/242)

mitra42 commented 4 years ago

Thinking .... have the table be a mix of regexp:string and string:string, cycle through Object.keys and test each regexp.match, if matches to a string.replace(regexp, string) and move on, else use the straight lookup.