AngularJS: How do I handle RESTful APIs with token security and custom methods?

So say I have a **RESTFul API** that has the standard `GET`, `POST`, `PUT`, and `DELETE` methods on it, but I also have other methods on it that are custom to specific object types, and on top of that I require a security token. so a URL for this service might look like this: **GET/PUT/POST/DELETE** http://sample.com/api/User/123?token=ABCDEF1234 and GET http://sample.com/api/User/GetUsersByStatus?token=ABCDEF1234¶m1=blah¶m2=foo or **POST** http://sample.com/api/User/DoSomethingCrazy?token=ABCDEF1234 where the last two do some custom functionality. Maybe it's something to reset a password, or maybe it's something to clone a user and return the record, I don't know. Just custom "stuff". What is the best-practice way to handle this with Angular? I've seen the $resource utility, but it seems to only be for the standard **REST** methods, and I'm not sure how to extend that in a way that the next Angular developer will understand.

以上就是AngularJS: How do I handle RESTful APIs with token security and custom methods?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏