DEV Community

LiHan
LiHan

Posted on

[ktor] Generate Ktor Project - Part 1

Ktor Project Link And Setting

https://start.ktor.io/

setting-1

setting-2

Download Project And Start it !

setting-3-start

Put Food Images

Image description

Create Model - Food

const val BASE_URL =  "http://127.0.0.1:8080/"

data class Food(
    val name : String,
    val description : String ,
    val imagePath : String
){
    companion object{
        val foodList = listOf<Food>(
            Food(
                name = "PorkRice",
                description = "basil minced pork with rice fried egg",
                imagePath = "$BASE_URL/static/food/food1.jpg"
            ),
            Food(
                name = "BBQ Chinese Food",
                description = "bbq grill cooked with hot spicy sichuan pepper sauce is chinese herb",
                imagePath = "$BASE_URL/static/food/food2.jpg"
            ),
            Food(
                name = "French fries",
                description = "crispy french fries with ketchup mayonnaise",
                imagePath = "$BASE_URL/static/food/food3.jpg"
            ),
            Food(
                name = "Vegetable",
                description = "This is Vegetable",
                imagePath = "$BASE_URL/static/food/food4.jpg"
            ),
            Food(
                name = "Noodle",
                description = "Great noodle !!",
                imagePath = "$BASE_URL/static/food/food5.jpg"
            ),
        )

    }
}

Enter fullscreen mode Exit fullscreen mode

Final Start Again To Test Image

example:
http://127.0.0.1:8080/static/food/food2.jpg

Get Food Image File From GitHub Plz

https://github.com/encorex32268/com.example.anyprojectnamehere

Top comments (0)