Example updated, with before function, handling errors, and static folder