0

I really don't understand javascript sometimes... I'm trying out feathersjs, and I really like the idea of the services/hooks architecture. I even see they include some conveniently preconfigured database services. So I see they also have the ability to generate the tables from my javascript (using knexjs) I figure hey this is great and really convenient and a nice in between using a full ORM and straight up sequel... problem is, it only works sometimes, because it seems every database adapter in javascript all run asynchronously I can't seem to figure out how to make it wait for the database to finish being created, before the rest of the framework configuration finishes...

I've spent nearly like... 5 hours wasting my time on this trying to understand why/how it works the way it does, when I could have just written a sql script (which I will be doing...)

I just want to curl up in a corner for a bit after this experience...

Comments
  • 0
    You shouldn't rely on synchronicity.

    ASYNC is an - although infuriating, confusing and lunatic - very important part of software programming...

    And it's even more important that your mindset can understand and work with ASYNC concepts.

    Whenever you'll encounter parallelism, you'll encounter either ASYNC or similar paradigms...

    :)

    Sorry, but you'll really should look into promises, which will solve your problems.

    PS: Especially in databases synchronicity is a lie. I could literally tell a thousand tales of people not getting the concepts of transactions because they simply forget that a database is an shared resource...
  • 0
    @IntrusionCM I get how promises work, that being said if I was writing some code that relied on the database being set up, on the initial run, would it not make sense to be able to wait for that to finish before executing the rest of the code?

    I understand why we have async and promises and such, and maybe it's just the way this framework is written that makes it difficult to do, but there should be a way to have the code wait for the tables to finish being created.
Add Comment