What?
CTodos is a Todos List web app, written in pure c. It only has a dependency on the c standard library.
It has been tested on linux, although it should work on other posix operating systems.
Why?
I thought that it would be really funny to do this in c, caveman style. Of course, it would be really hard to do a complex project, so I picked a simple todos app.
How?
The sockets api in the C standard library allows you to create a TCP server.
From there, we can create a simple http implementation, and build a web application
It extensively uses sprintf for templating behind the scenes
Where to run?
Due to security concerns, this application won't be publicly hosted. Instead, run the docker container locally.
The sources and build instructions are available at the github repo
The application has a compile-time dependency on gnu autotools (autoconf and automake), but has no runtime dependencies (other then the libc)
The application will run on port 8080 at ipv6 [::1]. By passing --disable-ipv6 to the ./configure script, you can make it always use and redirect you to ipv4. Currently, the application will always make redirects to [::1]:8080 on ipv6 builds and localhost:8080 on ipv4 builds.
To make it redirect to something else, edit the todo_page_handler in src/router.c, and replace the lines
sprintf(res + strlen(res), "Location: http://[::1]:%d/\r\n",
SERVER_PORT);
and
sprintf(res + strlen(res), "Location: http://localhost:%d/\r\n",
SERVER_PORT);
with your preferred redirect link. It should redirect you to the index page

Log in or sign up for Devpost to join the conversation.