actix-web-nextjs-spa

Crates.ioactix-web-nextjs-spa
lib.rsactix-web-nextjs-spa
version0.1.1
sourcesrc
created_at2023-07-30 09:40:20.318517
updated_at2023-07-30 09:44:34.911415
descriptionActix Web Next.js SPA service
homepagehttps://github.com/frysztak/actix-web-nextjs-spa
repositoryhttps://github.com/frysztak/actix-web-nextjs-spa
max_upload_size
id929833
size26,397
Sebastian Frysztak (frysztak)

documentation

README

Actix Web Next.js SPA service

Actix Web service for hosting statically exported Next.js apps.

This is a fork of Spa service from actix-web-lab with added support for Next.js dynamic routes.

How it works

It searches for Next.js's _buildManifest.js and builds a tree of routes from it. Request to, e.g., /pet/dog/husky resolves into /pet/[petType]/[breed].html.

Sample usage

Exactly the same as original SPA service:

use actix_web::App;
use actix_web_nextjs_spa::spa;
let app = App::new()
    // ...api routes...
    .service(
        spa()
            .index_file("./web/spa.html")
            .static_resources_location("./web")
            .finish()
    );

License

This project is licensed under either of the following licenses, at your option:

Commit count: 2

cargo fmt