ngxcmod

High level wrapper for build nginx module w/ nginx-c-function

Wrapper score 30/100 · tests present · docs generated

Wraps a native library — check OS Compatibility below for platform-specific linking notes.

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:24

Installation

nimble install ngxcmod
choosenim install ngxcmod
git clone https://github.com/ba0f3/ngxcmod.nim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
ngxcmod - - - - - - -

Source

Repository https://github.com/ba0f3/ngxcmod.nim
Homepage https://github.com/ba0f3/ngxcmod.nim
Documentation View Documentation
Registry Source nimble_official

README

ngxcmod

This module contains high level API definations to build module for Nginx with nginx-link-function

For low level API, please import ngxcmod/raw

Requirements

Usage

Nim module

import ngxcmod, strutils

proc init(ctx: ContextCycle) {.init.} =
  ctx.cyc_log(INFO, "hello from Nim")

proc exit(ctx: ContextCycle) {.exit.} =
  ctx.cyc_log(WARN, "goodbye, from Nim w/ <3")

proc hello(ctx: Context) {.exportc.} =
  ctx.log(INFO, "Calling back and log from hello")
  let
    name = ctx.getQueryParam("name")
    message = "hello $#, greeting from Nim" % name
  ctx.response(200, "200 OK", CONTENT_TYPE_PLAINTEXT, message)

proc post(ctx: Context) {.exportc.} =
  ctx.response(200, "200 OK", CONTENT_TYPE_PLAINTEXT, ctx.getBodyAsStr())

Nginx config

http {
...
    server {
...
        ngx_link_func_lib "./your-module.so";
        location = /hello {
            ngx_link_func_call "hello";
        }
...
}