Похожие чаты

Hey guys, I want to seperate asp.net core routes in other

file than Startup.cs

I want all routes with their methods and controller actions in same file

what should I do ?

9 ответов

5 просмотров

Why not follow a convention, then you just have to set up the mask in Startup.cs.

Masoud- Автор вопроса
Shafiq Jetha
Why not follow a convention, then you just have to...

with convention we can't set http method and controller action both toghether as I know 🤔

Masoud
with convention we can't set http method and contr...

Can you not use attributes like HttpGet and HttpPost for that?

Masoud- Автор вопроса
Shafiq Jetha
Can you not use attributes like HttpGet and HttpPo...

I can but I don't like that 😕 I want to seperate them like other frameworks in other languages

Masoud
I can but I don't like that 😕 I want to seperate t...

But asp.net has its own convention, and it’s usually best to follow that unless you have a good reason not to.

I tried to do something similar: https://github.com/ronnygunawan/express-netcore

Masoud- Автор вопроса
Ronny Gunawan ️
I tried to do something similar: https://github.co...

good but didn't need that here we go... 1) app.UseEndpoints(Routes.routes); 2) public static class Routes { public static void routes(IEndpointRouteBuilder router) { router.MapGet("/", HomeController.Index); } } 3) public class HomeController : Controller { public static async Task Index(HttpContext ctx) { await ctx.Response.WriteAsync("f*** this life"); } }

Похожие вопросы

Обсуждают сегодня

Anyone here suffers from unexplained aural migraines, who would be up for talking for a bit? Doesn't *have* to be aural, but I am not asking about headaches, I mean actual mi...
Martin Rys
55
We heading to 1.1$ 🤔?
CryptoBo$$
35
A couple thoughts from a random internet stranger: 1. If you want this project to gain traction you cannot keep being negative. If I just came here after finding out about Kd...
Eric Wild
45
Сonst magicTgHTML = (text, entities) => { let processedText = text; let offsetShift = 0; entities.forEach(entity => { const { offset, length, type, url, ...
Андрей
1
кто-то пользуется компонентами rx ? как их лучше ставить, через OPM? (lazarus)
Iluha Companets
15
But what if some projects may have no sense financially but important from public relations point of view and overall adoption (which leads to more investors so more income). ...
Katu
3
Поставил генту, установил кланг, когда запускаю его не давая ему файла он выводит странную ошибку, в чем может быть дело? max@gentoo ~> clang /usr/bin/x86_64-pc-linux-gnu-ld.b...
молодой базз
8
Здравствуйте товарищи! решил всё таки поставить линукс. Порядок создание разделов /boot/efi 200МиБ; /boot 1000; подсистему / 80000; swap 8Гб Будет норм?
K2
19
How Will #Monero Be Attacked? First of all I want to tell you that this is not teaching the network attackers, the central regulators. They already know how to attack the net...
Li₿ΞʁLiøη
3
подскажите пожалуйста, как мне освободить результат записанный в переменную result? в чем проблема подскажите если МОЖЕТЕ?
Михаил Helper
28
Карта сайта