В приложении с использованием svelte backend и frontend сервера запускаются с разных источников (разный хост или порт), то есть необходимо выполнение cors-запросов (cross origin request sharing). Для работы такого приложения необходимо использовать библиотеку cors.

Short example:

Setup sveltejs:

$ npx degit sveltejs/template app-name
$ cd app-name && npm install
$ npm run dev

Building the API:

$ mkdir api && cd api
$ npm init -y
$ npm install express cors body-parser
$ touch app.js

app.js:

const express = require('express')
const bodyParser = require('body-parser')
const cors = require('cors')

const app = express()
app.use(bodyParser.json())
app.use(cors())

const content = 'some kind of content'

app.get('/', (req, res) => {
    res.send(content)
})

app.listen(8081, () => {
    console.log('App's running on port 8081')
})

Start it: $ node app.js

Get data for Svelte:

<script>
    import { onMount } from 'svelte'
    
    onMount(async() => {
        await fetch('http://localhost:8081')
            .then(res => res.json())
            .then(data => {
                // some code
            })
    })
</script>