
Background Knowledge:
Servers are the backbone of all our smart electronics now, they act as the brains behind our connected devices. As such, server design is an ever increasing field of coding. Unfortunately, we have some poorly designed servers, and there is no standardized rules for server design. From my experience coding servers, I have learned some of the standards in a few companies. Which I took from this what works and what does not, and implemented this as the standards for server programming at MIM.
Quick Run:
From constantly having to recode the server base, I have decided to do what some of the other companies do. Create a Swagger document first, and get that approved. The reason for this is at one job I had to recode the entire server code 3 times in the span of a week. Luckily the server was made in Haskell so it was relatively simple to do this. However this was changed to C++, and it became a lot harder to code this up (used the regex library in STL to make it simpler for me). From now on I write swagger documentation first, approve it, and ONLY than start coding it up.

The benefit of swagger is a default codegen, unfortunately it does not handle more complex languages/systems. Some of the downsides are the lack of proper cookie support, which is a quite common task now.
The biggest area of API design revolves around REST API development. These are systems designed to have minimalistic input from the server, the client initiates all connections. Now this poses a challenge, how do we handle notifications?
Well we can handle notifications using another server in the background and a series of webhooks. The other way is to constantly refresh the API we are looking at. The first way is ideal as it allows for us to limit bandwidth, however for individuals who do not know how to do this the second way offers a simple way to do it.
Most Important Tidbits:
- Just because Swagger documentation is approved does not mean it is good for the final product
- Swagger codegen still requires quite a few changes
- JSON objects are the easiest to work with on both server and client sides