Skip to content

Migrate from GoAhead Skill

Migrate GoAhead embedded web server applications to the Ioto platform with API conversion, configuration migration, and verification testing.

Invoke with: /migrate-goahead

Migration Workflow

GoAhead Application

  Phase 1: Analysis & Planning

  Phase 2: Code Transformation

  Phase 3: Verification & Testing

  Migrated Ioto Application

Phase 1: Analysis

  • Identify web server configuration, request handlers, and URL routing patterns
  • Map authentication and authorization schemes
  • Generate a feature comparison matrix with migration effort estimates
  • Identify risks and platform-specific code

Phase 2: Code Transformation

API Substitution Table

websGetVar(wp, "name", NULL)   →  webGetVar(req, "name", NULL)
websWrite(wp, format, ...)     →  webWrite(req, format, ...)
websSetStatus(wp, code)        →  webSetStatus(req, code)
websDone(wp)                   →  (not needed)
websOpen(docs, ports)          →  webAlloc() + webSetDocuments() + webListen()
websDefineHandler(name, fn)    →  webAddHandler(web, pattern, fn)
websRedirect(wp, url)          →  webRedirect(req, code, url)
websError(wp, code, msg)       →  webError(req, code, msg)

Request Processing

c
// GoAhead
static int testHandler(Webs *wp) {
    char *name = websGetVar(wp, "name", "World");
    websSetStatus(wp, 200);
    websWrite(wp, "Hello %s", name);
    websDone(wp);
    return 1;
}

// Ioto
static void testHandler(Web *web, WebRequest *req) {
    cchar *name = webGetVar(req, "name", "World");
    webWriteResponse(req, 200, "Hello %s", name);
}

Configuration Migration

Converts GoAhead route.txt to Ioto web.json5:

json5
{
    web: {
        listen: ['http://*:80'],
        documents: '/var/www',
        routes: [{
            match: '/',
            handler: 'file',
            auth: 'basic',
            role: 'user'
        }]
    }
}

Phase 3: Verification

  1. Build the migrated application without errors or warnings
  2. Generate test suites to verify functional equivalence
  3. Validate configuration, routing, authentication, and protocol compliance
  4. Benchmark performance against the original GoAhead application

Key Differences

  • GoAhead handlers return int (1 = handled); Ioto handlers return void
  • GoAhead's websDone() is not needed in Ioto — response completion is automatic
  • GoAhead's Webs *wp parameter maps to two Ioto parameters: Web *web and WebRequest *req
  • GoAhead's single-threaded event model maps naturally to Ioto's fiber model