<commit_before>package com.azavea.rf.api

import ch.megard.akka.http.cors.CorsDirectives._
import ch.megard.akka.http.cors.CorsSettings
import com.azavea.rf.api.aoi.AoiRoutes
import com.azavea.rf.api.config.ConfigRoutes
import com.azavea.rf.api.datasource.DatasourceRoutes
import com.azavea.rf.api.exports.ExportRoutes
import com.azavea.rf.api.featureflags.FeatureFlagRoutes
import com.azavea.rf.api.feed.FeedRoutes
import com.azavea.rf.api.grid.GridRoutes
import com.azavea.rf.api.healthcheck._
import com.azavea.rf.api.image.ImageRoutes
import com.azavea.rf.api.maptoken.MapTokenRoutes
import com.azavea.rf.api.organization.OrganizationRoutes
import com.azavea.rf.api.project.ProjectRoutes
import com.azavea.rf.api.scene.SceneRoutes
import com.azavea.rf.api.thumbnail.ThumbnailRoutes
import com.azavea.rf.api.token.TokenRoutes
import com.azavea.rf.api.tool.ToolRoutes
import com.azavea.rf.api.toolcategory.ToolCategoryRoutes
import com.azavea.rf.api.toolrun.ToolRunRoutes
import com.azavea.rf.api.tooltag.ToolTagRoutes
import com.azavea.rf.api.uploads.UploadRoutes
import com.azavea.rf.api.user.UserRoutes
import com.azavea.rf.api.utils.Config

/**
  * Contains all routes for Raster Foundry API/Healthcheck endpoints.
  *
  * Actual routes should be written in the relevant feature as much as is feasible
  *
  */
trait Router extends HealthCheckRoutes
  with UserRoutes
  with OrganizationRoutes
  with SceneRoutes
  with ProjectRoutes
  with AoiRoutes
  with ImageRoutes
  with TokenRoutes
  with ThumbnailRoutes
  with ToolRoutes
  with ToolTagRoutes
  with ConfigRoutes
  with ToolCategoryRoutes
  with ToolRunRoutes
  with GridRoutes
  with DatasourceRoutes
  with MapTokenRoutes
  with FeedRoutes
  with UploadRoutes
  with ExportRoutes
  with Config
  with FeatureFlagRoutes {

  val corsSettings = CorsSettings.defaultSettings

  val routes = cors() {
    pathPrefix("healthcheck") {
      healthCheckRoutes
    } ~
      pathPrefix("api") {
        pathPrefix("projects") {
          projectRoutes<commit_msg>Update CORS to allow requests from other domains<commit_after>package com.azavea.rf.api

import akka.http.scaladsl.model.HttpMethods._

import ch.megard.akka.http.cors.CorsDirectives._
import ch.megard.akka.http.cors.CorsSettings
import com.azavea.rf.api.aoi.AoiRoutes
import com.azavea.rf.api.config.ConfigRoutes
import com.azavea.rf.api.datasource.DatasourceRoutes
import com.azavea.rf.api.exports.ExportRoutes
import com.azavea.rf.api.featureflags.FeatureFlagRoutes
import com.azavea.rf.api.feed.FeedRoutes
import com.azavea.rf.api.grid.GridRoutes
import com.azavea.rf.api.healthcheck._
import com.azavea.rf.api.image.ImageRoutes
import com.azavea.rf.api.maptoken.MapTokenRoutes
import com.azavea.rf.api.organization.OrganizationRoutes
import com.azavea.rf.api.project.ProjectRoutes
import com.azavea.rf.api.scene.SceneRoutes
import com.azavea.rf.api.thumbnail.ThumbnailRoutes
import com.azavea.rf.api.token.TokenRoutes
import com.azavea.rf.api.tool.ToolRoutes
import com.azavea.rf.api.toolcategory.ToolCategoryRoutes
import com.azavea.rf.api.toolrun.ToolRunRoutes
import com.azavea.rf.api.tooltag.ToolTagRoutes
import com.azavea.rf.api.uploads.UploadRoutes
import com.azavea.rf.api.user.UserRoutes
import com.azavea.rf.api.utils.Config

import scala.collection.immutable.Seq

/**
  * Contains all routes for Raster Foundry API/Healthcheck endpoints.
  *
  * Actual routes should be written in the relevant feature as much as is feasible
  *
  */
trait Router extends HealthCheckRoutes
  with UserRoutes
  with OrganizationRoutes
  with SceneRoutes
  with ProjectRoutes
  with AoiRoutes
  with ImageRoutes
  with TokenRoutes
  with ThumbnailRoutes
  with ToolRoutes
  with ToolTagRoutes
  with ConfigRoutes
  with ToolCategoryRoutes
  with ToolRunRoutes
  with GridRoutes
  with DatasourceRoutes
  with MapTokenRoutes
  with FeedRoutes
  with UploadRoutes
  with ExportRoutes
  with Config
  with FeatureFlagRoutes {

  val settings = CorsSettings.defaultSettings.copy(
    allowedMethods = Seq(GET, POST, PUT, HEAD, OPTIONS, DELETE))

  val routes = cors(settings) {
    pathPrefix("healthcheck") {
      healthCheckRoutes
    } ~
      pathPrefix("api") {
        pathPrefix("projects") {
          projectRoutes
{'fraction_non_alphanumeric': 0.08093440302029259, 'fraction_numerical': 0.0, 'mean_word_length': 4.469677419354839, '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': '3943247', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1468, 'n_words': 275}