2 releases
0.1.1 | Jul 30, 2023 |
---|---|
0.1.0 | Jul 30, 2023 |
#960 in HTTP server
14KB
266 lines
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:
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
Dependencies
~17–32MB
~529K SLoC