pico-http/http/http.h
Andrew Gundersen 9904bd2212 init commit
2022-05-02 08:00:44 -05:00

31 lines
444 B
C

#ifndef _HTTP_H_
#define _HTTP_H_
#define PORT "3000"
typedef struct
{
char type[100];
char path[200];
}
Req;
typedef struct
{
int status;
char* content_type;
int content_length;
char* body;
}
Res;
/* User defined handlers must be this shape */
typedef void (*Handler)(Req* req, Res* res);
/* Add an api endpoint */
void use(char* path, Handler handler);
/* Start the server */
int http_start(char* port);
#endif