No description
Find a file
Jake Leahy a1a61e831b
breaking: Rename Path to PathParam to remove the collision with stdlib (#70)
With the focus on types going forward, best to remove this collision so
its easier to use the two. Most of the time you aren't writing out
`Path` anyways so shouldn't break much
2025-12-31 04:31:46 +00:00
.github Generate docs for both stable and devel 2025-12-29 20:09:22 +11:00
src breaking: Rename Path to PathParam to remove the collision with stdlib (#70) 2025-12-31 04:31:46 +00:00
tests breaking: Rename Path to PathParam to remove the collision with stdlib (#70) 2025-12-31 04:31:46 +00:00
.gitignore Make logging into a middleware (#63) 2025-12-14 18:03:30 +11:00
changelog.md Add multipart (#3) 2022-07-08 21:22:27 +10:00
config.nims Support async responses (#65) 2025-12-28 01:33:17 +00:00
example.nim Performance testing in the CI (#54) 2024-10-29 19:52:24 +11:00
mike.nimble Make logging into a middleware (#63) 2025-12-14 18:03:30 +11:00
readme.md Link to stable docs by default, update badge so its only for the main branch 2025-12-29 20:11:08 +11:00

Tests

Docs

Simple framework that I use for all my personal projects. Mostly used for writing small API's and website

Quick overview

Just create an app then add your routes

var app = initApp()

# Fully typed handlers
app.get("/home") do () -> string:
  "hello"
    
"/mike" -> post:
  ctx.send("Teapot", Http427)

You can specify before/after handlers by prefixing the verb

# You get information via typing your proc
app.beforeGet("/^path") do (path: string):
  # Log all requests that happen
  echo path

Has seen in the examples the ctx variable is used which is an implicit variable that allows you to access everything about the request and specify what the response will be.

Context hooks

A nice feature of Mike that sets it apart from other Nim frameworks is support for context hooks that allow you to add parameters to your routes that get information for you and handle if its missing

"/some/route" -> post(x: Header[string], data: Json[SomeObject], page: Query[int]) ->
    # Do stuff with parameters here

You can make your own context hooks to do anything from load some json to getting a database connection from a pool