Skip to content

SamJakob/WebServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebServer

https://github.com/SamJakob/WebServer/tree/master/LICENSE https://github.com/SamJakob/WebServer/issues

An Objective-C WebServer with WebSockets support implemented using BSD's POSIX socket APIs and utilizing Grand Central Dispatch for multithreading.

The routing API is heavily inspired by Express.js (my actual preference for building web applications) and the repository also includes a very basic simple ncurses-based CLI.

image

[server on:GET path:@"/" execute:^(Request* request, Response* response){
    [response append:@"<p>hi</p>"];
}];
[server onWebSocketConnection:@"/echo" execute:^(Request* request, WebSocket* socket){

  [socket onMessage:^(NSString* message){
    // Simply sends the received message back to the client.
    [socket sendString:message];
  }];

}];

Features

  • Fast and lightweight.
  • Fully asynchronous handlers for HTTP requests.
  • Supports CRUD methods (GET, POST, PUT, PATCH, DELETE).
  • Express.js-derived API emphasizing readability.
  • IPv4 support.
  • WebSocket support out of the box.

Releases

No releases published

Packages

No packages published