Nim: How to parse a URL/URI

Mar 22, 2022

Parsing a URL into its contituent parts is possible via uri module in the stdlib:

import std/uri
let myUri = parseUri("https://alice:secrets@glenngillen.com:8080/foo?q=bar#baz")
echo myUri.scheme # https
echo myUri.username # alice
echo myUri.password # secrets
echo myUri.hostname # glenngillen.com
echo myUri.port # 8080
echo myUri.path # /foo
echo myUri.query # q=bar
echo myUri.anchor # baz
Hi, I'm Glenn! 👋 I'm currently Director of Product (Terraform) @ HashiCorp, and we're hiring! If you'd like to come and work with me and help make Terraform Cloud even more amazing we have multiple positions opening in Product ManagementDesign, and Engineering & Engineering Management across a range of levels (i.e., junior through to senior). Please send in an application ASAP so we can get in touch.