https://github.com/samjakob/webserver
An Objective-C webserver with an Express-inspired API
https://github.com/samjakob/webserver
grand-central-dispatch multithreading objective-c posix webserver
Last synced: 3 months ago
JSON representation
An Objective-C webserver with an Express-inspired API
- Host: GitHub
- URL: https://github.com/samjakob/webserver
- Owner: SamJakob
- License: mit
- Created: 2020-02-29T21:38:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-28T21:23:10.000Z (over 3 years ago)
- Last Synced: 2025-01-22T12:25:09.692Z (5 months ago)
- Topics: grand-central-dispatch, multithreading, objective-c, posix, webserver
- Language: Objective-C
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WebServer
 
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](https://expressjs.com/) (my actual preference for building web applications)
and the repository also includes a very basic simple ncurses-based CLI.
```objc
[server on:GET path:@"/" execute:^(Request* request, Response* response){
[response append:@"hi
"];
}];
``````objc
[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.