Welcome to nope.c

nope.c is a light flyweight platform for creating lightning fast and scalable network applications using C language.

Just to give an idea of how light nope.c is, an app to print the "Hello world" page has a memory footprint(PSS) of 66KB in nope.c, which is about 1/135 of that node.js's 9MB or 9000KB footprint for the same app.

Simple example: Display factors of a given number

#include "server.h"
#include "nopeutils.h"

void factor(int client,const char * reqStr, const char * method);

void server(Request request)
{ 
	routefh(request,"/factor",&factor);
}

void factor(int client,const char * reqStr, const char * method) {
	char *nStr=HSCANIT(client,reqStr,"Number to factor:");

	if (strcmp(nStr,UNDEFINED)!=0) {
		long n = strtol(nStr,NULL,10);
		nprintf(client,"Factors of %li are: ", n);
		long l;
		for(l=2;l<=n;++l) {
			if(n%l==0) {
				nprintf (client,"%li ",l);
			}
		}
	}
}

Try it yourself

Clone our repo and get writing the most lightweight web apps imaginable.

Using nope.c is as easy as one, two, three

1. Clone nope.c repo from github

git clone https://github.com/riolet/nope.c.git

2. Write your where indicated in server.c

void server(Request request){
	/*Your Code Here*/
}

3. To make and run your app, simply execute

./run.sh PORT

where the PORT is the port nope.c will listen for incoming connections.