Giter VIP home page Giter VIP logo

Comments (5)

dnmeid avatar dnmeid commented on June 20, 2024 1

I can reproduce this bug.

from companion.

dnmeid avatar dnmeid commented on June 20, 2024

Please give the complete HTTP request you have used.

from companion.

LHasenbein avatar LHasenbein commented on June 20, 2024

@dnmeid

<script>
const url = 'http://localhost:8888/api/custom-variable/timecode/value';

fetch(url)
    .then(response => {
        if (!response.ok) {
            throw new Error('Netzwerkantwort war nicht ok');
        }
        return response.text();
    })
    .then(data => {
        console.log('Antwort:', data);
    })
    .catch(error => {
        console.error('Fehler beim Abrufen der Daten:', error);
    });
</script>

from companion.

dnmeid avatar dnmeid commented on June 20, 2024

We have a default route which serves the home page if no other route is matched.

this.app.get('*', (req, res, next) => {
req.url = '/index.html'
return webuiServer(req, res, next)
})

The error seems to be that this route is matched before the the api route can match. I don't know why this is happening. All legacy api routes are matched before the default route and all http POST routes are matched before the default route.
The route in question is the only GET route for the new api.

from companion.

dnmeid avatar dnmeid commented on June 20, 2024

Ok, the reason is, that the new api routes are included here

this.httpApi.bindToApp(registry.ui.express.app)
after the routes of the web ui.
The default route of the web ui only handles get methods, so all post requests of the new api are fulfilled but the default get will match before any api get route can match.
@Julusian you did the way of binding the new api router. Is there any reason for that or can we change it to the same way the legacy api is included?

Another more hacky soution would be to not match the default route to *, but to /^(?!\/api).*/

from companion.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.