cargo build --release
go build -trimpath
node index.js
Last active
July 24, 2020 06:42
-
-
Save codenoid/cac8697eb8a6241082de4ff7bfffaf25 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use actix_web::{web, App, HttpResponse, HttpServer, Responder}; | |
async fn index() -> impl Responder { | |
HttpResponse::Ok() | |
.header("Content-Type", "text/plain; charset=utf-8") | |
.body("Hello world!") | |
} | |
#[actix_rt::main] | |
async fn main() -> std::io::Result<()> { | |
HttpServer::new(|| { | |
App::new() | |
.route("/", web::get().to(index)) | |
}) | |
.bind("127.0.0.1:8088")? | |
.run() | |
.await | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/valyala/fasthttp" | |
// request handler in fasthttp style, i.e. just plain function. | |
func fastHTTPHandler(ctx *fasthttp.RequestCtx) { | |
ctx.Write([]byte("Hello world!")) | |
} | |
func main() { | |
// pass plain function to fasthttp | |
fasthttp.ListenAndServe(":8081", fastHTTPHandler) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nanoexpress from 'nanoexpress-pro'; | |
const app = nanoexpress(); | |
app.get('/', (req, res) => { | |
return res.send('Hello world!'); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment