Nim: Making a HTTP GET request | Glenn Gillen
Nim: Making a HTTP GET request

Nim: Making a HTTP GET request

Mar 21, 2022

Get requests in Nim are fairly straight-forward:

import std/httpclient
var client = newHttpClient()
echo client.getContent("https://google.com")

Nim also supports async requests, so to do the same but asynchronously:

import std/[asyncdispatch, httpclient]
proc asyncProc(): Future[string] {.async.} =
var client = newAsyncHttpClient()
return await client.getContent("https://google.com")
echo waitFor asyncProc()
Hi, I'm Glenn! 👋 I've spent most of my career working with or at startups. I'm currently the Director of Product @ Ockam where I'm helping developers build applications and systems that are secure-by-design. It's time we started securely connecting apps, not networks.

Previously I led the Terraform product team @ HashiCorp, where we launched Terraform Cloud and set the stage for a successful IPO. Prior to that I was part of the Startup Team @ AWS, and earlier still an early employee @ Heroku. I've also invested in a couple of dozen early stage startups.