I'm a bit new to svelte and javascript. I'm trying to build a page with many API components from external websites and I struggle a bit. I don't really know where to put the different bits of code. The closer I am no is this :

in Bapi.svelte (component) :

```
<script>

    function getSomething() {
        fetch('getapi')
    }
</script>

<h1>get something here</h1>
<button on:click={getSomething}>Get !</button>

```

in server.js (routes) :

```
import sirv from 'sirv';
import express from 'express';
import compression from 'compression';
import * as sapper from '@sapper/server';

const { PORT, NODE_ENV } = process.env;
const dev = NODE_ENV === 'development';

const app = express();

app.use(express.urlencoded())
app.use(express.json())

    app.use(
        compression({ threshold: 0 }),
        sirv('static', { dev }),
        sapper.middleware()
    )
    .listen(PORT, err => {
        if (err) console.log('error', err);
});

```

in getapi.js (routes) :

```
export function get(res, req, next) {
    var resp = app.endpoints.coinbasepro.get('/coinbase-products');
    console.log(resp)
}

```

When I click on get i have this error : app is not defined. I maybe has something to do with the scope but after moving the variable around for a while I need some help because I am stuck at this point. Thanks