Skip to content

Commit

Permalink
Merge pull request #1 from mountaindude/feature
Browse files Browse the repository at this point in the history
Added id of created app in API response
  • Loading branch information
mountaindude authored Jan 5, 2017
2 parents fa7e984 + 08c038d commit 75bd839
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Standard curl is used below, the assumption is that the command is executed on t
curl -X GET "http://localhost:8000/getTemplateList"
```

Returns a HTTP 200 response, with a json structure such as
Returns a HTTP 200 response, with a JSON structure such as

```json
[{
Expand Down Expand Up @@ -91,13 +91,23 @@ Returns
```
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 22
Date: Thu, 22 Dec 2016 07:35:28 GMT
Content-Length: 83
Date: Thu, 05 Jan 2017 22:28:08 GMT
Connection: close
"Done duplicating app"
{"result":"Done duplicating app","newAppId":"794e4003-aa89-4a4e-9120-7eb4d6314a32"}
```

I.e. the JSON structure is

```json
{
"result": "Done duplicating app",
"newAppId":"794e4003-aa89-4a4e-9120-7eb4d6314a32"
}
```



### Query Parameters
```
Expand All @@ -117,17 +127,7 @@ The new app will be reloaded (using the load script from the template app) befor
curl -X GET "http://localhost:8000/duplicateKeepScript?appName=My%20new%20app&templateAppId=11111111-2222-3333-4444-555555555555&ownerUserId=joe"
```

Returns

```
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 22
Date: Thu, 22 Dec 2016 07:35:28 GMT
Connection: close
"Done duplicating app"
```
The response from the service is exactly the same as for the /duplicateNewScript endpoint (see above).


### Query Parameters
Expand Down
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,9 @@ function respondDuplicateNewScript(req, res, next) {
return globalEngine.connection.close();
})
.then(() => {
logger.log('info', 'Done duplicating');
res.send('Done duplicating app');
logger.log('info', 'Done duplicating, new app id=' + newAppId);
var jsonResult = {result:"Done duplicating app", newAppId:newAppId }
res.send(jsonResult);
next();
})
.catch(err => {
Expand Down Expand Up @@ -384,8 +385,9 @@ function respondDuplicateKeepScript(req, res, next) {
return globalEngine.connection.close();
})
.then(() => {
logger.log('info', 'Done duplicating');
res.send('Done duplicating app');
logger.log('info', 'Done duplicating, new app id=' + newAppId);
var jsonResult = {result:"Done duplicating app", newAppId:newAppId }
res.send(jsonResult);
next();
})
.catch(err => {
Expand Down

0 comments on commit 75bd839

Please sign in to comment.