What is faster performance wise? Creating a REST API and having your web app use the REST API to do all interactions with your database OR querying your database directly (i.e. using whatever typical object your language uses to query a database such as JDBC for Java)?The way I see it with REST:You make an object in your code to call the REST methodCall http methodCode inside your REST API queries the databaseDatabase returns some data REST API code packs up the data into Json and sends it to your clientClient receives Json/XML response Map response to an object in your codeOn the other hand, querying a database directly:You make an object with query string to query the databaseDatabase returns some dataMap response to an object in your codeSo wouldn't this mean that using a REST API would be slower? Maybe it depends on the type of database (SQL vs NoSQL)?
What is faster? Using REST API or querying a database directly?
database;rest;sql