Written in C++ and running on the IncludeOS unikernel, Acorn is a highly efficient web application with direct access to the library operating system's facilities
Set up a working web application with just a few lines of code.
C++ web application framework inspired by Node.js and Express.js.
// Serve index.html on GET /
router.on_get("/",
[disk] (auto, auto res)
{
disk->fs().cstat("/index.html",
[res] (auto err, const auto& entry)
{
if(err)
res->send_code(http::Not_Found);
else
res->send_file({disk, entry});
});
});
Easily serve a static front page with a few lines of code.
Make use of and create simple middlewares to power up the web application.
#include <butler>
#include <director>
// Serve files from "public/" directory on file requests
Middleware_ptr butler = std::make_shared<Butler>(disk, "/public");
server.use(butler);
// Display simple directory view of directory "public/static"
Middleware_ptr director = std::make_shared<Director>(disk, "/public/static");
server.use("/static", director);
Serve and display files by utilizing middlewares.
IncludeOS is the leanest, purest form of unikernel. Written from scratch in C++, we leverage all the advantages of writing a single-service operating system; we use 100% asynchronicity and simplicity all the way from device drivers, through the whole network stack and up to and including our new framework for building Node.js-style REST APIs in blazingly fast, modern C++14.
IncludeOS on GitHub