Actix Web is a Rust framework for asynchronous HTTP servers, REST APIs, and server-rendered web applications. An `HttpServer` receives requests, an `App` groups routes, and each route selects a handler by path and HTTP method. A handler constructs the HTTP response. section 3.3 section 7.0
Start with a health check
Register `cfg.route("/health", web::get().to(health_check_handler))` in a `web::ServiceConfig`. The async handler returns `HttpResponse::Ok().json(...)`. Build the app with `App::new().configure(general_routes)`, then start it with `HttpServer::new(app).bind("127.0.0.1:3000")?.run().await`. A GET request to `/health` reaches that handler. section 3.1.1 section 3.1.2
Extend the same structure into a course API:
- Define `POST /courses` to create a course, `GET /courses/{tutor_id}` to list a tutor’s courses, and `GET /courses/{tutor_id}/{course_id}` to retrieve one course. section 3.2.1 section 3.2.6
- Keep route definitions, handlers, models, and application state in separate modules. Use `web::Path<(i32, i32)>` for the two identifiers in the detail handler. section 3.2.1 section 3.2.6
- Put shared data in `web::Data<AppState>` and register it with `App::app_data`. Handlers receive that state as a parameter; a `Mutex` protects mutable in-memory values shared across workers. section 3.2.2
The server runs application instances on worker threads and also uses asynchronous I/O. The initial course API stores data in memory; a later iteration replaces that store with Postgres while retaining the APIs. Test handlers with constructed state and path parameters, and exercise running endpoints with a browser or `curl`. These sample tests demonstrate the technique rather than exhaustive failure coverage. section 3.3 section 4.0 section 3.2.6
For a web frontend, the same framework can serve static pages with `actix-files` and render dynamic pages with a template engine. A static-file route can be registered with `App::service(fs::Files::new("/static", "./static"))`. section 7.2 section 7.0

