Nim: How to build a HTTP server
Mar 21, 2022
Nim uses the Nimble package managet to bundle dependencies (it's included with Nim as of 0.15.0). Using nimble
we can install the prologue
server
$ nimble install prologue
and now implementing a basic web server is not to dissimilar to Sinatra, ExpressJS, or most other minimalist frameworks:
import prologueproc hello*(ctx: Context) {.async.} =resp "<h1>Hello World!</h1>"let app = newApp()app.get("/", hello)app.run()
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.
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.