This seems like it should be simple but cannot quite work out how.
I want to be able to make a file in the root of the application to by dynamically served.
ie
https://localhost:5000/test.json
to be handled by a controller. Its easy if you just have a path without a. but if its a json or js file it seems to get handled differently by the server.
ok really simple - just needed to do this in startup.cs
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/test.js", context => context.Response.WriteAsync("Hello world"));
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.