Skip to content

Commit da84964

Browse files
committed
Return created instance
1 parent 2b72c32 commit da84964

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/epsilon/server/instances/routes.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ pub async fn create(
1616
template: &str,
1717
content: Json<Value>,
1818
context: &State<Arc<Context>>,
19-
) -> Result<(), EpsilonError> {
19+
) -> Result<String, EpsilonError> {
2020
let instance_provider = context.get_instance_provider();
2121

22-
instance_provider
22+
let instance = instance_provider
2323
.start_instance(template, Some(content.0))
2424
.await
2525
.map_err(|_| {
@@ -31,7 +31,9 @@ pub async fn create(
3131

3232
info!("An instance has been created (template={})", template);
3333

34-
Ok(())
34+
Ok(serde_json::to_string(&instance.to_json().await?)
35+
.map_err(|_| EpsilonError::ParseJsonError("Create Instance".to_owned()))?
36+
)
3537
}
3638

3739
#[rocket::post("/close/<instance>")]

0 commit comments

Comments
 (0)