<commit_before>import Vapor

extension Droplet {
  func setupRoutes() throws {
    get("hello") { req in
      var json = JSON()
      try json.set("hello", "world")
      return json
    }

    get("apod") { req in
      let res = try self.client.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY")
      return try JSON(node: [
        "text": "NASA Pic of the Day",
        "attachments": [
          "image_url": res.data["url"],
          "title": res.data["title"]
        ]
      ])
    }

    try resource("posts", PostController.self)
  }
}<commit_msg>Add post for slack<commit_after>import Vapor

extension Droplet {
  func setupRoutes() throws {
    get("hello") { req in
      var json = JSON()
      try json.set("hello", "world")
      return json
    }

    get("apod") { req in
      return try self.getNasaData()
    }
    
    post("apod") { req in
      return try self.getNasaData()
    }

    try resource("posts", PostController.self)
  }
    
    private func getNasaData() throws -> JSON {
      let res = try self.client.get("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY")
      return try JSON(node: [
        "text": "NASA Pic of the Day",
        "attachments": [
            "image_url": res.data["url"],
            "title": res.data["title"]
        ]
      ])
    }
}
{'fraction_non_alphanumeric': 0.14600760456273765, 'fraction_numerical': 0.0, 'mean_word_length': 2.1634615384615383, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '6863802', 'n_tokens_mistral': 440, 'n_tokens_neox': 429, 'n_words': 101}