Saltearse al contenido

Hola Mundo

Construyamos tu primera aplicación con Zuno: un servidor HTTP mínimo que responde con un saludo. Este ejemplo demuestra lo simple que es comenzar con Zuno.


hello-world/
├── CMakeLists.txt
└── main.cpp

cmake_minimum_required(VERSION 3.20)
project(hello_world)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(
zuno
GIT_REPOSITORY https://github.com/zuno-framework/zuno.git
GIT_TAG main
)
FetchContent_MakeAvailable(zuno)
add_executable(hello-world main.cpp)
target_link_libraries(hello-world PRIVATE Zuno::Zuno)

#include <zuno/zuno.hpp>
int main() {
zuno::App app;
app.get("/", [](Request& req, Response& res) {
res.send("¡Hola desde Zuno!");
});
app.listen(3000);
}

Terminal window
cmake -B build
cmake --build build
./build/hello-world

Deberías ver:

Servidor Zuno ejecutándose en http://localhost:3000

Visita http://localhost:3000 en tu navegador y verás:

¡Hola desde Zuno!

Ahora que construiste tu primera app con Zuno, prueba:


Zuno te permite pasar de “Hola Mundo” a APIs listas para producción—sin el exceso de código.