Home > Net >  API/address remains the same, according to the parameters for the specific implementation, how to do
API/address remains the same, according to the parameters for the specific implementation, how to do

Time:10-04

Such as api.taobao.com so a fixed url

CMD=the order according to the transmission, such as parameters. The create is invoked to create the order. The update is modified, the order. The delete will delete

Generally they are based on DNS or what to do, code usually need how to do?

CodePudding user response:

Address remains the same, HTTPMETHOD can

Increase with the HttpPost
Modified with HttpPut
Modify the local use HttpPatch
Remove with HttpDelete

Can,

CodePudding user response:

If it is the ordinary
The API/user/create
Then basic is routing.


If this is the API? CMD=order. The create
There is a strong possibility is reflected.
The class through the API to find the order under the create method... Then go to receive post parameters...

CodePudding user response:

For webapi, this is just an interface, parameter is CMD and other additional
In this interface you again to determine what is CMD
After you with his own factory pattern
If even the switch will be fine

CodePudding user response:

Routing

No matter he used that skill, generally referred to as the routing, you can use nginx routing, you can use the mq routing, you can use the MVC routing, you can use the eventbus routing

CodePudding user response:

Here is the.net version, other routing the ans not

At the very least, the MVC routing, and had never rules must be written as {control}/{action}

Why can't be a CMD={contorl}. {action}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Ye Qiu can greatly the ans autumn the programmers will only be stoned walnuts, not with walnut stone?? Not the factory, not reflection, still routing

CodePudding user response:

The
refer to the original poster QQ group _76535892 reply:
so a fixed url such as api.taobao.com

CMD=the order according to the transmission, such as parameters. The create is invoked to create the order. The update is modified, the order. The delete will delete

Generally they are based on DNS or what to do, code usually need how to do?

No, he USES the API as a container, the parameters of the received reflection or into the corresponding business method, this is just a design pattern,

If is to want to do it, such as autofact ioc directly to do good,

Wondering how I said this is open source, but you may want to take a period of time,

CodePudding user response:

This may be the underlying a esb bus doing processing, but we should also can realize the route webapi matching strategy

CodePudding user response:

reference 5 floor wanghui0380 reply:
, at the very least, the MVC routing, and had never rules must be written as {control}/{action}

Why can't be a CMD={contorl}. {action}


God wants us to meet a few wrong people wake up a language

CodePudding user response:

http://nancyfx.org/

Actually see such third party frameworks can more understand what did webapi,

CodePudding user response:

Provided by default routing CMD={contorl} / {action}
But if you want to CMD={contorl} . {action}, if not, may need to rewrite

CodePudding user response:

, upstairs are bosses, experts, summarize the bosses required to rewrite your proposal should be routing, then according to the custom routing

CodePudding user response:

reference 5 floor wanghui0380 reply:
here is the.net version, other routing the ans not

At the very least, the MVC routing, and had never rules must be written as {control}/{action}

Why can't be a CMD={contorl}. {action}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Ye Qiu can greatly the ans autumn the programmers will only be stoned walnuts, not with walnut stone?? Not the factory, not reflection, still routing

Bosses, API if no action, and routing can't use a little break up, I don't know is there any way to

CodePudding user response:

The
reference 1 floor XBodhi. Response:
address remains the same, HTTPMETHOD variable can

Increase with the HttpPost
Modified with HttpPut
Modify the local use HttpPatch
Remove with HttpDelete

Can,



Follow the HTTP protocol

CodePudding user response:

Reference
, API if no action, and routing can't use a little break up, don't know is there any way to

What I don't want to waste more brains and build a API project, conveniently in the FilterConfig. Cs to define

//
//abstract:
//map application features define routing,
//
//parameters:
//configuration:
//server configuration,
//
//constraintResolver:
//constraint resolution procedures,
Public static void MapHttpAttributeRoutes (this HttpConfiguration configuration, IInlineConstraintResolver constraintResolver);
//
//abstract:
//map application features define routing,
//
//parameters:
//configuration:
//server configuration,
//
//directRouteProvider:
//to be used to discover and generate Routing System. Web. Http. Routing. IDirectRouteProvider,
Public static void MapHttpAttributeRoutes (this HttpConfiguration configuration, IDirectRouteProvider directRouteProvider);
//
//abstract:
//map application features define routing,
//
//parameters:
//configuration:
//server configuration,
//
//constraintResolver:
//used to parse the inline constraint System. Web. Http. Routing. IInlineConstraintResolver,
//
//directRouteProvider:
//to be used to discover and generate Routing System. Web. Http. Routing. IDirectRouteProvider,
Public static void MapHttpAttributeRoutes (this HttpConfiguration configuration, IInlineConstraintResolver constraintResolver, IDirectRouteProvider directRouteProvider);



See so many overloaded?

ConstraintResolver:
//used to parse the inline constraint System. Web. Http. Routing. IInlineConstraintResolver,
//
//directRouteProvider:
//to be used to discover and generate Routing System. Web. Http. Routing. IDirectRouteProvider,

Basically, the problem has solved the



But, for me personally, I am not here to play, because now in front of the project and a layer of nginx, in most cases the thing to play on the nginx, after all, I told you here, now is not a project early farmland s, nginx proxy all PHP, Java, perl, cgi,.net, python, go - you use their features, does not need to change the route, outside the nginx pinch up to you

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related