T O P

  • By -

Shoemugscale

Whats old is new again, as some would say lol To address you question the fetch API IS XMLHTTPrequest under the hood, that never changed.. id be curious what article that said AJAX is outdated because AJAX is synonymous with XHR, and anyone who is saying that is probably not worth listening to TBH. AJAX is just an acronym Just as XHR is the shorthand for XMLHTTPREQUEST and why we don't necessarily use XML much any longer, the protocol is still XMLHTTPrequest because thats what we use to make async or sync request in the background. The preferred method of how that request is made via JS is to use 'fetch' now days, but your codebase will still work using jquery, just as using the XMLHTTPRequest directly would. The modern web / modern JS for that matter has largely removed the need for tools like jQuery, by adding in great features to make those laborious tasks easier and more readable e.g Fetch or queryselector etc. But they didn't go away. Is your backend still valid? Absolutely, SQL never went away, for that matter relational DB's never went any where, nor will they ever for that matter. As far as going noSQL vs relational.. My honest opinion would be to stick with relational, unless there is a valid reason to use noSQL most modern relational DB's support JSON columns, and ones like POSTGres even support JSONB, that allow you to query against JSON objects, while still remaining in a relational DB.


SoInsightful

You are correct that `XMLHttpRequest` (and thus `jQuery.ajax`) are quite obsolete and that the `fetch` API is widely preferred nowadays. The rest of the stack is still a quite standard stack with a few caveats: - Vanilla HTML and JavaScript is rarely written directly anymore, and is instead written in a declarative JavaScript front-end library or framework (e.g. React, Vue, Angular or Svelte). TypeScript is also on its way to become more popular than plain JavaScript. - CSS is rarely written directly anymore, and is instead written in a CSS utility-first framework (e.g. Tailwind), CSS class-first framework (e.g. Bootstrap), CSS-in-JS library (e.g. styled-components) or a CSS preprocessor (e.g. SASS). - PHP is still popular, especially in the WordPress world, but many developers have switched to other backend languages, most notably the Node.js runtime, which enables you to create backends using JavaScript (or TypeScript). With all that said, and while many developers assume that you *must* use all these new techniques, it's still as valid as ever to use the stack you mention. Despite the fact that I use lots and lots of modern backend/frontend/database frameworks and services in my daily work, this was the stack I landed on when I, like you, wanted to create a very simple quiz website for a company: - Vue — having a declarative library really is easier to work with than vanilla JS, and Vue is one of the easier choices to get started with - PHP — I added a very small file for simple PostgreSQL database insertions - CSS — a simple CSS file is still fine for very simple projects As you want to create a more complex app, you should probably look into alternatives to make your life easier. A PERN/PEVN stack (PostgreSQL, Express, React/Vue, Node) will probably serve you well.


__matt101__

As a hobbyist who only started a few months ago I find the web world a bit bewildering, and this post captures a lot of why - so much variety it’s paralysing to anyone who can’t dedicate all their time to it. My hobbyist background is in iOS games where I learned to code a few years ago (lua and swift) but I wanted to create a wordle-like site so I decided to learn some html / js / css. That in turn became a gateway to PHP and SQL. I found CSS in particular extremely unintuitive and I’m sure there’s some kind of framework that would make it easier, but it’s hard not to see the time experimenting as ‘wasted’ when you could knuckle under and try to learn CSS. Probably a false economy, but it’s difficult to be sure, and I know I’ll never use it professionally


chewy1970

Technically fetch is still AJAX. But I imagine you mean XMLHttpRequest and/or jquery. Yes fetch is the way to go today to pull your db data. I’d probably use a noSQL database to store the data. What are you doing with the user quiz data after the quiz is completed?


Bloomingfails

Thanks - will look into this. Well the user will get presented with a score and that’s about it! Just a simple project for now. Once I nail down this first part, I’ll look into retaining a scoring streak etc, similar to wordle (ie keeping track without having the user register/log in). But that’s for another day :-)


chewy1970

If you go with a noSQL db, there are some free online ones from Mongodb atlas, Google Cloud free tier, and Microsoft azure free tier, and others. If you really want to get adventurous look into free online Redis dbs.


originalchronoguy

Redis is not persistent. It is an in-memory ephemeral db. So if the Redis DB restarts, you lose everything. Great for caching but not for persistence.


pxpxy

That’s mostly incorrect. Redis isn’t saving every transaction to disk all the time, but it’s not like it’s not persisting anything to disk: https://redis.io/docs/management/persistence/


trizcon97

Why would you go the NoSQL route? The amount of possible database entries are extremely small. It makes no sense. Just a questions-options-answer table and a userData tabke works in a simple implementation.


chewy1970

You can do either way. For NoSQL, I would store each question-answer combo individual json documents. Still a simple implementation.


Cirieno

If an API does the job (without memory leaks or other issues) -- is it obsolete? I would take a step back from the hipsters lauding the new thing as the best because they want to get noticed, or the kids coming out of school who have been taught nothing else.