- Docker build
- Deploy to heroku with ENV VARIABLES (DB, URI)
- DB = Mongodb database name
- URI = Mongodb URI string in the format
user@password:url
data class User(
val email: String,
val name: String,
val password: String?,
)
data class Post(
val _id: String,
val title: String,
val content: String,
val email: String,
val created: Long,
val updated: Long,
)
data class PostRequest(
val content: String,
val title: String,
val email: String,
val password: String
)
data class Response<out T>(
val status: Boolean,
val errorMessage: String,
val value: T,
)
List all users
Response:
// List of users but without password field
val value: List<User>
Check if the user with email exists
Response:
// true if user exists
val value: Boolean
Login with email and password
Request:
// only email & password (not name)
User
Response:
// User object with password to store in local db
val value: User
Register with email, name and password
Request:
User
Response:
// email is returned back
val value: String
List all posts available, if email given list all posts published by that user
Query Params:
// user email optional
val email: String
Response:
val value: List<Post>
Returns the post by id
Response:
val value: Post
Updates the existing post
Request:
PostRequest
Response:
// post id
val value: String
Publish new post
Request:
PostRequest
Response:
// post id
val value: String
Delete the post
Request:
// current user
User
Response:
val value: Boolean