
Dan S. answered 10/02/19
A seasoned software and systems engineer.
This is a pretty good question. There are a few things I'd consider moving forward. For one, are you authoring this in TypeScript? Is your JSON data structured? By this I mean, could you use a JSON schema and AJV validator on both the front-end (to ensure that what is being sent is at least valid to the schema), and then be able to evaluate on the server side (the api route) that what has been sent is still valid using, again, a schema validator like AJV? Any sensitive checks such as looking up user data or sensitive app data should be handled on the service/api layer. It's faster, and, you don't want to expose those kinds of lookups to the client (front-end).
If you're developing this application in parallel you should be ensuring that the data your sending follows a standard (schema) that both teams have agreed on. You should standardize on a validation tool, like AJV or something else, to ensure that what is sent matches the schema, and what is received matches the schema.
The only thing Unit tests are going to do in this case is just have some dummy data that's in the correct format (e.g., the schema you agreed on). But unit tests aren't going to cover some of the patterns that I mentioned above... both teams need to have solid development practices.