Skip to content

KumKeeHyun/cin-conic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cin-conic

simple webframwork writing in c language

  • Support simple Restful API router
    • GET ,POST
    • URL param
  • File transfer in response body
    • HTML, PNG, JPG
    • support static file in project directory

Run

$ make
$ sudo ./main

Result

Example main

void param(Context *ctx) {
    char *arg;
    if (GetData(ctx->req.map, "arg", (void**)&arg, cpyString) >= 0) {
        SendMsg(ctx, StatusOK, arg);
        free(arg);
    } else {
        SendMsg(ctx, StatusInternalServerError, "param error");
    }
}

int main(int argc, char *argv[]) {
    Router *r = NewRouter();
    Static(r, "view");
    Static(r, "view/img");

    GET(r, "/", helloWorld);
    GET(r, "/image/png", png);
    GET(r, "/param/:arg", param);

    StartServer(r, "8080");

    return 0;
}

image

About

simple webframwork writing in C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published