Created
March 3, 2020 02:38
-
-
Save willthames/5faae957f58782826725bb242d2016ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local tokenize = {} | |
function tokenize.tokenize(uri) | |
-- URLs that end in an ID | |
for _, path in ipairs({“/api/jobs, “/api/resources”}) do | |
if string.find(uri, path .. "/[^/]*") then | |
return string.gsub(uri, path .. "/.*", path .. "/{id}") | |
end | |
end | |
return uri | |
end | |
return tokenize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment