Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions examples/porting-may_minihttp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "porting-may_minihttp"
version = "0.1.0"
description = "Porting of the crate may_minihttp"
license = "MIT"
edition = "2021"
exclude = ["index.node"]

[lib]
crate-type = ["cdylib"]

[dependencies]
neon = "1.1.0-alpha.1"
may_minihttp = "0.1.11"
19 changes: 19 additions & 0 deletions examples/porting-may_minihttp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# porting-may_minihttp

Porting of the crate [may_minihttp](https://crates.io/crates/may_minihttp) ([GitHub repository](https://github.com/Xudong-Huang/may_minihttp)).

## Usage

```js
const { HttpServer, HttpService, Request, Response } = require(".");

class HelloWorld extends HttpService {
call(_req: Request, res: Response) {
res.body("Hello, world!");
}
}

const server = HttpServer(HelloWorld).start("0.0.0.0:8080").unwrap();

server.join().unwrap();
```
27 changes: 27 additions & 0 deletions examples/porting-may_minihttp/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "porting-may_minihttp",
"version": "0.1.0",
"description": "Porting of the crate may_minihttp",
"main": "index.node",
"scripts": {
"build": "cargo-cp-artifact -nc index.node -- cargo build --message-format=json-render-diagnostics",
"install": "npm run build",
"test": "cargo test"
},
"license": "MIT",
"devDependencies": {
"cargo-cp-artifact": "^0.1.9"
},
"repository": {
"type": "git",
"url": "git+https://github.com/neon-bindings/examples.git"
},
"keywords": [
"Neon",
"Examples"
],
"bugs": {
"url": "https://github.com/neon-bindings/examples/issues"
},
"homepage": "https://github.com/neon-bindings/examples#readme"
}
2 changes: 2 additions & 0 deletions examples/porting-may_minihttp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use neon::prelude::*;
use may_minihttp::{BodyReader, HttpServer, HttpService, HttpServiceFactorye, Request, Response};