This project includes a sample REST service written in Kotlin using the Vert.x reactive microservice toolset.
- Build with
/.gradlew build
, creates JAR in build/libs - Start with
/.gradlew run
, executesmain
directly, no command line arguments can be passed - Start with arguments by executing JAR from build/libs with
java -jar <jarname> --server.port=8181
The application can be configured with following arguments
Parameter | Description | Default |
---|---|---|
server.port | Port of REST endpoint | 8181 |
mongo.host | Host name of running MongoDB instance | localhost |
mongo.port | Port of running MongoDB instance | 27017 |
mongo.dbname | Database name in MongoDB instance | projects_db |
All values may be overridden by passing the arguments as follows:
--server.port=8181
The application may be started with "dev" profile which will make the application on an in-memory database.
Simply pass the following argument when starting: --profile=dev
The REST endpoint is available at localhost:<server.port>/projects and speaks Json.
Entity Project(_id: String, name: String)
Entity Result(success: Boolean)
Entity ErrorResponse(message: String, error: Int, context: String)
-
on /:projectId returns
- found
Project
if available ErrorResponse(1000)
with HTTP status 400 if noProject
withprojectId
is available
- found
-
on / returns all available
Project
entities as JSON array
- on / with
Project
as json request body returns- newly saved
Project
if successful ErrorResponse(1000)
with http status 400 if noProject
withprojectId
is available
- newly saved
- on / with
Project
as json request body returns- updated
Project
if successful ErrorResponse(1001)
with http status 400 if noProject
withprojectId
is available
- updated
-
on /:projectId returns
Result
entity if successful, i.e. correspondingProject
can be found and deletedErrorResponse(1000)
with http status 400 if noProject
withprojectId
is available
-
on / returns
Result
entity, allProject
s will be removed