We are trying to remove all the references to Lipton template from our project, to keep it only serve API methods. What is the proper way to do that so that no longer Razor Page could be rendered?
4 Answer(s)
-
0
- In ABP, “Lepton/LeptonX” is just a UI theme on top of ASP.NET Core MVC/Razor Pages. To make your backend serve pure APIs (and ensure no Razor Page can be rendered), the proper approach is to use the
HttpApi.Hostproject as your host (or convert your current host to the same minimal API host style) and do not include any MVC UI / Razor Pages / Theme modules.
1) Host only the API (recommended ABP way)
- Use/run only the
*.HttpApi.Hostproject (tiered solution) as your backend. - Ensure your
HttpApi.Hostmodule does not depend on any of these kinds of packages/modules:Volo.Abp.AspNetCore.Mvc.UI.*Volo.Abp.AspNetCore.Mvc.UI.Theme.*(Lepton/LeptonX)- Any
...Webmodule that brings MVC UI/Razor Pages
Result: there are no UI endpoints to render because the host doesn’t include UI at all.
2) If you must keep a single host, don’t map Razor Pages endpoints
In your host’s
Program.cs, map only controllers (APIs) and don’t map Razor Pages:app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseConfiguredEndpoints(endpoints => { endpoints.MapControllers(); // Do NOT add this: // endpoints.MapRazorPages(); });3) Expose only application services as APIs (ABP conventional/auto controllers)
Enable ABP auto controllers so your Application Services are exposed as REST endpoints (and you don’t need any UI stack):
using Volo.Abp.AspNetCore.Mvc; Configure<AbpAspNetCoreMvcOptions>(options => { options.ConventionalControllers.Create(typeof(MyProjectApplicationModule).Assembly); });This keeps the backend focused on API endpoints only.
Sources
- https://abp.io/docs/latest/framework/api-development/auto-controllers
- https://abp.io/support/questions/10577
- https://abp.io/docs/latest/framework/ui/mvc-razor-pages/theming
This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) - In ABP, “Lepton/LeptonX” is just a UI theme on top of ASP.NET Core MVC/Razor Pages. To make your backend serve pure APIs (and ensure no Razor Page can be rendered), the proper approach is to use the
-
0
Hi,
Yes, this is doable. The clean ABP setup for it is the separated (non-bundled) architecture: the API host references your
HttpApi/Application/ EF layers plus JWT bearer auth, and it does not include the LeptonX theme or the Account login UI. That already removes the whole Lepton / MVC UI surface, which is the main thing you're after.Two things worth knowing so there are no surprises:
- Login is the main reason Razor sticks around. The interactive login screen is a Razor Page from the Account module, and OpenIddict renders it for browser-based sign-in. So if this backend still needs users to log in through a browser, keep that in a dedicated Auth Server project and let the API host stay UI-free. If auth is purely token-based (a separate Auth Server / frontend / external IdP handles login), the API host needs no login UI at all.
- If your goal is literally zero Razor Pages, note that ABP's MVC maps Razor Pages by default and a couple of framework UI modules still ship one (for example the multi-tenancy tenant-switch UI), so you'd also remove those
*.Mvc.UI.*modules, not just the LeptonX theme.
To give you the exact modules and packages to strip out for your project, could you share:
- ABP version and template (app / microservice, and MVC / Blazor / Angular).
- Is your solution single-project (the host also renders the UI and acts as the auth server), or already split into separate
HttpApi.Host/AuthServerprojects? - Does this backend still need to serve an interactive browser login, or is auth purely token-based?
With that I'll give you the precise list of module
DependsOnentries andPackageReferences to remove.Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
thank you very much
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
You're welcome. Whenever you're ready, just share your project structure (version, template, single-project vs separated) and whether you still need a browser login, and I'll send you the exact module/package changes for your project.
Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)