Is this a good approach of creating retrofit? ```...
# android
a
Is this a good approach of creating retrofit?
Copy code
private val retrofit = Retrofit.Builder()
//    .baseUrl(Constant.URL + Constant.VERSION)
    .baseUrl("<http://192.168.1.128:5000/api/>")
    .addConverterFactory(GsonConverterFactory.create())
    .build()

interface RegisterRepository {
    @FormUrlEncoded
    @POST("/api/register")
    suspend fun register(
        @Field("email") email: String,
        @Field("password") password: String
        )User
}
object RegisterApi {
    val retrofitService : RegisterRepository by lazy {
        retrofit.create(RegisterRepository::class.java)
    }
}
p
There is a channel for square libs, #squarelibraries. In regards to the code it smells a little bit. The
/api
path might be repeated. Also using direct ip address can generate issues with certificate verification, however you are using http not https so would be fine.
z
it should be
@POST("api/register")