Skip to content

Commit 56313cf

Browse files
committed
update README
1 parent cbde300 commit 56313cf

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ Lightbug is a simple and sweet HTTP framework for Mojo that builds on best pract
2828
This is not production ready yet. We're aiming to keep up with new developments in Mojo, but it might take some time to get to a point when this is safe to use in real-world applications.
2929

3030
Lightbug currently has the following features:
31+
- [x] Pure Mojo networking! No dependencies on Python by default
3132
- [x] Set up a server to listen on a given host/port
3233
- [x] Assign your own custom handler to a route
3334
- [x] Craft HTTP requests and responses with built-in primitives
3435
- [x] Everything is fully typed, with no `def` functions used
3536

3637

3738
We're working on support for the following (contributors welcome!):
38-
- [ ] Pure Mojo networking (while most of the code is in Mojo, we call Python's `socket` library in several parts of the code)
3939
- [ ] Better error handling, improved form/multipart and JSON support
4040
- [ ] Multiple simultaneous connections, parallelization and performance optimizations
4141
- [ ] WebSockets, HTTP 2.0
@@ -104,22 +104,25 @@ Once you have Mojo up and running on your local machine,
104104
We plan to add routing in a future library called `lightbug_api`, see [Roadmap](#roadmap) for more details.
105105
3. Run `mojo main.mojo`. This will start up a server listening on `localhost:8080`. Or, if you prefer to import the server into your own app:
106106
```mojo
107-
from lightbug_http.io.bytes import Bytes
108-
from lightbug_http.python.server import PythonServer
107+
from lightbug_http.sys.server import SysServer
109108
from lightbug_http.service import Printer
110109
111110
112111
fn main() raises:
113-
var server = PythonServer()
112+
var server = SysServer()
114113
let handler = Printer()
115114
server.listen_and_serve("0.0.0.0:8080", handler)
116115
```
117-
118116
Feel free to change the settings in `listen_and_serve()` to serve on a particular host and port.
119117

120118
<p align="right">(<a href="#readme-top">back to top</a>)</p>
121119

122-
120+
## Switching between pure Mojo and Python implementations
121+
By default, Lightbug uses the pure Mojo implementation for networking. To use Python's `socket` library instead, just import the `PythonServer` instead of the `SysServer` with the following line:
122+
```mojo
123+
from lightbug_http.python.server import PythonServer
124+
```
125+
You can then use all the regular server commands in the same way as with the default server.
123126

124127
<!-- ROADMAP -->
125128
## Roadmap

main.mojo

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from lightbug_http.io.bytes import Bytes
2-
from lightbug_http.service import Printer
31
from lightbug_http.sys.server import SysServer
2+
from lightbug_http.service import Printer
43

54

65
fn main() raises:

0 commit comments

Comments
 (0)