Skip to content

Instantly share code, notes, and snippets.

@codenoid
Last active July 24, 2020 06:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codenoid/cac8697eb8a6241082de4ff7bfffaf25 to your computer and use it in GitHub Desktop.
Save codenoid/cac8697eb8a6241082de4ff7bfffaf25 to your computer and use it in GitHub Desktop.
cargo build --release
go build -trimpath
node index.js
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
}
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)
}
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