Question: I was trying to use the REST API of TeamCity but i can't find a list of all supported requests and the names of parameters. I wanted to look it up in their official documentation (<https://confluence.jetbrains.com/display/TCD10/REST+API>)  

where a link to exactly this list is provided  

(<http://teamcity:8111/app/rest/application.wadl>)  

but i just can't connect to it. Seems like the page is down.

I have googled all kinds of stuff in the hope to find this list somewhere else but i couldn't find anything smart.

Does anyone know where to find such a list or can provide one? That would be fantastic.

Thanks

Answer: 
The error is not refering to `myfunction` but to `start`.

```
async function start() {
   ....

   const result = await helper.myfunction('test', 'test');
}

```

---

```js
// My function
const myfunction = async function(x, y) {
  return [
    x,
    y,
  ];
}

// Start function
const start = async function(a, b) {
  const result = await myfunction('test', 'test');

  console.log(result);
}

// Call start
start();
```

---

---

I use the opportunity of this question to advise you about an known anti pattern using `await` which is : `return await`.

---

**WRONG**

```js
async function myfunction() {
  console.log('Inside of myfunction');
}

// Here we wait for the myfunction to finish
// and then returns a promise that'll be waited for aswell
// It's useless to wait the myfunction to finish before to return
// we can simply returns a promise that will be resolved later

// useless async here
async function start() {
  // useless await here
  return await myfunction();
}

// Call start
(async() => {
  console.log('before start');

  await start();

  console.log('after start');
})();
```

---

**CORRECT**

```js
async function myfunction() {
  console.log('Inside of myfunction');
}

// Here we wait for the myfunction to finish
// and then returns a promise that'll be waited for aswell
// It's useless to wait the myfunction to finish before to return
// we can simply returns a promise that will be resolved later

// Also point that we don't use async keyword on the function because
// we can simply returns the promise returned by myfunction
function start() {
  return myfunction();
}

// Call start
(async() => {
  console.log('before start');

  await start();

  console.log('after start');
})();
```

---

Also, know that there is a special case where `return await` is correct and important : (using try/catch)

[Are there performance concerns with `return await`?](https://stackoverflow.com/questions/43353087/are-there-performance-concerns-with-return-await/43985067#43985067)
**To use `await`, its executing context needs to be `async` in nature**

As it said, you need to define the nature of your `executing context` where you are willing to `await` a task before anything.

**Just put `async` before the `fn` declaration in which your `async` task will execute.**

```
var start = async function(a, b) { 
  // Your async task will execute with await
  await foo()
  console.log('I will execute after foo get either resolved/rejected')
}

```

**Explanation:**

In your question, you are importing a `method` which is `asynchronous` in nature and will execute in parallel. But where you are trying to execute that `async` method is inside a different `execution context` which you need to define `async` to use `await`.

```
 var helper = require('./helper.js');   
 var start = async function(a,b){
     ....
     const result = await helper.myfunction('test','test');
 }
 exports.start = start;

```

**Wondering what's going under the hood**

`await` consumes promise/future / task-returning methods/functions and `async` marks a method/function as capable of using await.

Also if you are familiar with `promises`, `await` is actually doing the same process of promise/resolve. Creating a chain of promise and executes your next task in `resolve` callback.

For more info you can refer to [MDN DOCS](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).