DEV Community

LiHan
LiHan

Posted on

1

[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

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay