Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • kata/tournament-api
1 result
Select Git revision
Loading items
Show changes

Commits on Source 18

Showing
with 797 additions and 0 deletions
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
\ No newline at end of file
# Tournament API
## Initialization
### Pre-requisites
Ensure you have the following tools installed on your machine:
- [Docker](https://www.docker.com/)
- [AWS CLI](https://aws.amazon.com/cli/)
### Starting the database
Navigate to the `docker/db` directory and run the following command to start the local database:
```bash
docker compose up -d
```
### Starting the API
1. Make sure that the database is up by executing
```bash
docker ps
```
Look for the `dynamodb-local` container in the list of running services
2. From the root directory, start the API using:
```bash
./gradlew run
```
---
## Available endpoints
Below is a list of available API endpoints and their usage:
| Endpoint goal | HTTP verb | URL | Body | Response |
|-------------------------------|-----------|------------------------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------|
| Create new player | POST | /players | { "pseudo" : "John" } | { "pseudo" : "John", "pointsNumber": 0 } |
| Update players points | PUT | /players | { "pseudo" : "John", "pointsNumber": 15 } | { "pseudo" : "John", "pointsNumber": 15 } |
| Get player by its pseudo | GET | /players/{pseudo} | | { "pseudo" : "Francis", "pointsNumber": 0 } |
| Get player info by its pseudo | GET | /players/{pseudo}/info | | { "pseudo" : "Francis", "pointsNumber": 0, rank : 2 } |
| Get players ranking | GET | /players/ranking | | [{ "pseudo" : "John", "pointsNumber": 15, rank : 1 }, { "pseudo" : "Francis", "pointsNumber": 0, rank : 2 }] |
| Delete player | DELETE | /players | | |
---
## Testing
To verify that the tests are functioning correctly, run the following command:
```bash
./gradlew clean test --info
```
---
## Preparing for Production
To deploy this application in a production environment, there are several key areas to address:
### 1. Security management :
**Database**
- Currently, a local database with dummy logging is used. For production, you can leverage AWS DynamoDB in the cloud by
connecting your API to a live DynamoDB instance.
- Be mindful of the costs associated with using a cloud database.
**Endpoints**
- All API endpoints are currently open to public access. For secure access, implement authentication using the
`ktor-server-auth` plugin.
- Consider using an IAM solution, such as:
- **AWS IAM**
- **Keycloak**
- **Microsoft EntraID**
- Additionally, you can use an API Gateway (e.g., Kong) to handle requests and manage security for your API.
### 2. Database and table creation
- Currently, the database is started manually, and table creation is handled at application startup.
- For production, use Terraform to manage the setup of DynamoDB tables and establish connections with AWS
infrastructure.
### 3. CI/CD Pipelines
Implementing CI/CD pipelines is essential for seamless deployment. Set up the following jobs in your repository:
- `install dependencies`: Cache reusable dependencies for subsequent jobs.
- `build`: Ensure the application compiles successfully.
- `test`: Run all application tests to validate functionality.
- `package`: Prepare the application for deployment.
- `deploy`: Create a manual, clickable job to deploy the application to the desired environment
### 4. GreenIT Considerations
- This application is primarily used during tournaments to calculate points and rankings.
- To reduce unnecessary resource consumption, we could set up infrastructure jobs to shut down the API when not in use
and restart it when needed.
\ No newline at end of file
val koin_version: String by project
val kotlin_version: String by project
val ktor_version: String by project
val logback_version: String by project
val dynamo_version: String by project
val dynamo_kt_version: String by project
val mockk_version: String by project
val kotlin_reactive_version: String by project
val koin_test_version: String by project
val assertj_core_version: String by project
val localstack_version: String by project
plugins {
kotlin("jvm") version "2.1.10"
id("io.ktor.plugin") version "2.3.13"
kotlin("plugin.serialization") version "1.9.0"
}
group = "betclic.test"
version = "0.0.1-SNAPSHOT"
application {
mainClass.set("io.ktor.server.netty.EngineMain")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
repositories {
mavenCentral()
}
dependencies {
// Ktor
implementation("io.ktor:ktor-server-core:$ktor_version")
implementation("io.ktor:ktor-server-auth:$ktor_version")
implementation("io.ktor:ktor-server-openapi:$ktor_version")
implementation("io.ktor:ktor-server-config-yaml:$ktor_version")
implementation("io.ktor:ktor-server-netty:$ktor_version")
implementation("io.ktor:ktor-server-status-pages:$ktor_version")
implementation("io.ktor:ktor-server-cors:$ktor_version")
// Dependency injection
implementation("io.insert-koin:koin-ktor:$koin_version")
implementation("io.insert-koin:koin-logger-slf4j:$koin_version")
// Content negociation
implementation("io.ktor:ktor-server-content-negotiation")
implementation("io.ktor:ktor-serialization-kotlinx-json")
implementation("ch.qos.logback:logback-classic:$logback_version")
// Database
implementation("software.amazon.awssdk:dynamodb-enhanced:$dynamo_version")
implementation("software.amazon.awssdk:dynamodb:$dynamo_version")
implementation("dev.andrewohara:dynamokt:$dynamo_kt_version")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$kotlin_reactive_version")
// Tests
testImplementation("io.ktor:ktor-server-test-host")
testImplementation("io.mockk:mockk:$mockk_version")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
testImplementation("io.insert-koin:koin-test:$koin_test_version")
testImplementation("org.assertj:assertj-core:$assertj_core_version")
testImplementation("org.testcontainers:localstack:$localstack_version")
}
# Local Database
Use this docker-compose file to run a local database for development.
## Usage
### Pre-requisites
You need to have Docker and AWS CLI installed on your machine
### How to start the database
In `docker/db` folder, run the following command:
```bash
docker compose up
```
version: '3.8'
services:
dynamodb-local:
command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data"
image: "amazon/dynamodb-local:latest"
container_name: dynamodb-local
ports:
- "8000:8000"
volumes:
- "./docker/dynamodb:/home/dynamodblocal/data"
working_dir: /home/dynamodblocal
\ No newline at end of file
File added
kotlin.code.style=official
koin_version=3.5.6
kotlin_version=2.1.10
dynamo_version=2.28.1
dynamo_kt_version=1.0.0
ktor_version=2.3.13
logback_version=1.4.14
mockk_version=1.10.0
kotlin_reactive_version=1.9.0
koin_test_version=3.4.0
assertj_core_version=3.24.2
localstack_version=1.20.4
\ No newline at end of file
File added
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
rootProject.name = "tournament-api"
package betclic.test
import betclic.test.configuration.configureExceptionHandling
import betclic.test.configuration.configureKoin
import betclic.test.configuration.configureRouting
import betclic.test.configuration.configureSerialization
import betclic.test.configuration.migrateTables
import io.ktor.server.application.*
import kotlinx.coroutines.runBlocking
fun main(args: Array<String>) {
io.ktor.server.netty.EngineMain.main(args)
}
fun Application.module() {
configuration()
initialize()
}
fun Application.configuration() {
configureKoin()
configureSerialization()
configureExceptionHandling()
configureRouting()
}
fun Application.initialize() = runBlocking {
migrateTables()
}
\ No newline at end of file
package betclic.test.configuration
import io.ktor.serialization.kotlinx.json.*
import io.ktor.server.application.*
import io.ktor.server.plugins.contentnegotiation.*
fun Application.configureSerialization() {
install(ContentNegotiation) {
json()
}
}
package betclic.test.configuration
import org.slf4j.LoggerFactory
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient
import java.net.URI
import software.amazon.awssdk.regions.Region
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider
class DynamoDbConfiguration {
private val logger = LoggerFactory.getLogger(DynamoDbConfiguration::class.java)
fun createDynamoDbClient(): DynamoDbAsyncClient {
return DynamoDbAsyncClient.builder()
.endpointOverride(URI("http://localhost:8000"))
.region(Region.US_EAST_1)
.credentialsProvider(
StaticCredentialsProvider.create(AwsBasicCredentials.create("dummy", "dummy"))
)
.build()
}
fun createDataSource(dynamoDbAsyncClient: DynamoDbAsyncClient): DynamoDbEnhancedAsyncClient {
logger.info("Using dynamo-db config")
return DynamoDbEnhancedAsyncClient.builder()
.dynamoDbClient(dynamoDbAsyncClient)
.build()
}
}
\ No newline at end of file
package betclic.test.configuration
import betclic.test.player.entities.PlayerEntity
import dev.andrewohara.dynamokt.DataClassTableSchema
import io.ktor.server.application.*
import kotlinx.coroutines.future.await
import kotlinx.coroutines.runBlocking
import org.koin.ktor.ext.inject
import org.slf4j.LoggerFactory
import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient
import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient
import kotlin.reflect.KClass
fun Application.migrateTables() {
val dynamoDbMigrationService: DynamoDbMigrationService by inject()
val dynamoDbClient: DynamoDbAsyncClient by inject()
val dynamoDbEnhancedClient: DynamoDbEnhancedAsyncClient by inject()
runBlocking {
dynamoDbMigrationService.createNecessaryTables(dynamoDbClient, dynamoDbEnhancedClient)
}
}
class DynamoDbMigrationService {
private val logger = LoggerFactory.getLogger(Application::class.java)
suspend fun createNecessaryTables(
dynamoDbClient: DynamoDbAsyncClient,
dynamoDbEnhancedClient: DynamoDbEnhancedAsyncClient
) {
val existingTables = dynamoDbClient.listTables().await().tableNames().toList()
listOf(PlayerEntity::class).forEach {
createTableIfNotExists(existingTables, it, dynamoDbEnhancedClient)
}
}
private suspend fun <T : Any> createTableIfNotExists(
existingTables: List<String>,
item: KClass<T>,
dynamoDbEnhancedClient: DynamoDbEnhancedAsyncClient
) {
val tableSchema = DataClassTableSchema(item)
if (existingTables.contains(item.simpleName)) {
logger.info("Table '${item.simpleName}' already exists.")
} else {
dynamoDbEnhancedClient.table(item.simpleName, tableSchema).createTable().await()
logger.info("Table '${item.simpleName}' created successfully.")
}
}
}
package betclic.test.configuration
import betclic.test.player.exceptions.AlreadyExistingPlayerException
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.plugins.*
import io.ktor.server.plugins.statuspages.*
import io.ktor.server.response.*
import software.amazon.awssdk.services.dynamodb.model.DynamoDbException
private const val SOMETHING_WENT_WRONG = "Something went wrong"
fun Application.configureExceptionHandling() {
install(StatusPages) {
exception<Throwable> { call, cause ->
when (cause) {
is NotFoundException -> call.respond(HttpStatusCode.NotFound, cause.message ?: SOMETHING_WENT_WRONG)
is DynamoDbException -> call.respond(
HttpStatusCode.InternalServerError,
cause.message ?: "$SOMETHING_WENT_WRONG with DynamoDb"
)
is AlreadyExistingPlayerException -> call.respond(
HttpStatusCode.BadRequest,
cause.message ?: SOMETHING_WENT_WRONG
)
}
call.respondText(text = "500: $cause", status = HttpStatusCode.InternalServerError)
}
}
}
\ No newline at end of file
package betclic.test.configuration
import betclic.test.player.repositories.PlayerRepository
import betclic.test.player.repositories.PlayerRepositoryImpl
import betclic.test.player.services.PlayerService
import betclic.test.player.services.PlayerServiceImpl
import io.ktor.server.application.*
import org.koin.dsl.module
import org.koin.ktor.plugin.Koin
import org.koin.logger.slf4jLogger
fun Application.configureKoin() {
install(Koin) {
slf4jLogger()
modules(databaseModule, playerModule)
}
}
val databaseModule = module {
single { DynamoDbConfiguration().createDynamoDbClient() }
single { DynamoDbConfiguration().createDataSource(get()) }
single { DynamoDbMigrationService() }
}
val playerModule = module {
single<PlayerRepository> { PlayerRepositoryImpl(get()) }
single<PlayerService> { PlayerServiceImpl(get()) }
}
package betclic.test.configuration
import betclic.test.player.routes.playerRoutes
import io.ktor.http.*
import io.ktor.server.application.*
import io.ktor.server.plugins.cors.routing.*
import io.ktor.server.routing.*
fun Application.configureRouting() {
install(CORS) {
allowMethod(HttpMethod.Get)
allowMethod(HttpMethod.Options)
allowMethod(HttpMethod.Put)
allowMethod(HttpMethod.Delete)
allowMethod(HttpMethod.Patch)
anyHost()
}
routing {
playerRoutes()
}
}
\ No newline at end of file
package betclic.test.configuration
import io.ktor.server.application.*
fun Application.configureSecurity() {
//TODO Add comment to say what I would do in term of security
}