As an intern I generally copy-pasted some database connection code in my PHP scripts to allow me to pull data about items and transactions. However, over time I've found that inconsitencies in our SKUs, different transaction flags, etc. often resulted in a need for additional code to avoid erroenous returns. For instance, some of our SKUs are padded to 14 characters in our database, while others are not - this seems to generally be based on whether an item is numeric but that determination isn't always cut-and-dry.
12345 <- Is numeric
DF248 <- Is not numeric
12-345 <- Is numeric
1-2-3 <- Is not numeric
Once I had 40hrs/week to devote to making my code better (and my life easier) I decided abstract the fetching of data from the logic that my code requires. I opted to spin up an API using node.js and express. This not only allowed me to abstract some of my often-duplicated functionality away, but also allows for simple and secure access from outside the Lumber Trader's environment. Item information like availability and pricing can be retrieved through a little bit of ajax on any external webpage instead of needing to be written in server-side code to prevent access to sensitive login information.
The API is already in use within pages on our website, a mobile app, and on the web. For a quick taste of the responsiveness of the API, take a look here: