An example of how a tinder api may be structured and implemented. This solution uses WebAPI 2, Owin Startup, and Ninject for Dependency Injection (IOC container).
- GET api/discoveries
- gets a list of discovered users to like/dislike.
- note: for a production environment, use either paged results or single user per request.
- POST api/discoveries/like/{userId}
- likes the specified user.
- POST api/discoveries/dislike/{userId}
- dislikes the specified user.
- GET api/discoverysettings
- gets the current users discovery settings.
- PUT api/discoverysettings
- updates the current users discovery settings.
- GET api/matches
- provides a list of matched users.
- GET api/users/{userId}
- provides the users profile information.
- Replaced JSON.NET Serializer with Jil (https://github.com/kevin-montrose/Jil)
- Deflate compression
- Use of Singleton Pattern throughout code (using Ninject).
- TPL usage throughout code (async/await).
- The use of REDIS or similar for caching.
- Use of an Enterprise service bus for cross-system notifications/push notifications.
- This is not a full implementation. Things like the database interaction implementation were left out for simplicity sake.
- This code assumes an authentication platform is also included.
- Ex: using an OAuth2 implementation that provides an access token with all requests on the authorization header.
- Database implementation emulates a database interaction with a Task.Delay(50);.
- All requests currently ignore any queryable data passed with the request for simplicity sake.
- A simple console application test app was written and tested with the /api/discoveries method to test performance.
- Current tests show about 850/calls per second.
- System specs include Intel Core I7 3930K, 16GB DDR3 RAM, executing on a 250GB SSD.