<commit_before>div.app-content
  h1 Business Logic
  div
    p.
      Mockr provides the option for the user to add business logic to the data that they persist.  
      
      When adding the route or editing it the user can specify some business logic that gets applied to the data
      
      as it gets posted to the api endpoint.  
    p.
      Some examples of code:
      
    span If you have a username property on one of the objects
      code.
        test
      <commit_msg>add business logic to docs<commit_after>div.app-content
  h1 Business Logic
  div
    p.
      Mockr provides the option for the user to add business logic to the data that they persist.  
      
      When adding the route or editing it the user can specify some business logic that gets applied to the data
      
      as it gets posted to the api endpoint. Remember that you can only use pure Javascript.

      The business logic you insert will be run when you do a POST request to the API endpoint you create in Mockr. You can access all the keys you passed in the request body. You can also access 'res' to end the response.

      Ex: If you do a POST to http://mockr.co/1/james/comments and pass {username: 'James', msg: 'Hi'}, you will have access to 'username' and 'msg' inside the business logic.

      Ex Business Logic: '(function() {msg = msg.upperCase(); }()'

      Ex Business Logic: '(function() {res = 'end response with a 500'}()'

    p.
      Some examples of code:
      
    span If you have a username property on one of the objects
      code.
        test
      
{'fraction_non_alphanumeric': 0.050031665611146296, 'fraction_numerical': 0.0037998733375554147, 'mean_word_length': 2.4051724137931036, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4816005', 'n_tokens_mistral': 424, 'n_tokens_neox': 403, 'n_words': 237}