The Student Room Group

Connecting to a database for my computer science A level project

Hi,

I'll be needing to start my A-level project soon, so I wanted to get ahead of myself and start thinking about it now.

I have an idea, and I think I want to make it a web project but I also want to connect to a database to add a level of complexity that will hopefully give me more things to document.

What's my best approach for this? I will be making the logic for the program in JavaScript, so what's the best database to use and how would I connect to it from code? I'm assuming I'll need to use Node to make a connection

Thanks
You'll want to look at setting up a MySQL database. Connecting: https://www.w3schools.com/nodejs/nodejs_mysql.asp

Node.js is what you'll need to connect to the database. It can be done client-side via JavaScript although this is certainly not recommended, nor the best practice. What this will likely mean is you'll need to develop an API in Node.js (using Express.js will be your best bet for doing this) that will connect to the database. You can then configure 'endpoints' which you can call in your web-project which will get your API to query the database for whatever you need.

You'll need to make API calls in your web-project either via the likes of Ajax, fetch, or some other imported HTTP library.
(edited 3 years ago)

Quick Reply

Latest

Trending

Trending