diff --git a/apiProject/README.md b/apiProject/README.md new file mode 100644 index 0000000..7af2e92 --- /dev/null +++ b/apiProject/README.md @@ -0,0 +1,22 @@ +# 🎓 UniQuest India — Statewise University Finde +A web app that uses University API to fetch and display universities across all states of India + +## 📌 About The Project +UniQuest India is a mini web project that allows users to search and explore universities statewise across India using a public REST API. Instead of manually searching, users can simply select or type a state name and instantly get a list of universities available in that region — all fetched in real-time using an API call. + +## 🔌 API Used +This project uses the Hipolabs University API - GET http://universities.hipolabs.com/search?country=india + +## 🙌 Acknowledgements +1. Apna College — For the Delta course and this assignment 💙 +2. Hipolabs API — For the free university data API + +## ✨ Features +1. 🔍 Search universities by state name in India +2. 🌐 Fetches live data using REST API +3. 📋 Displays university name, state. +4. ⚡ Dynamic rendering with JavaScript + +## 🙋♂️ Author +Ashlesha Meshram +GitHub: ashleshameshram diff --git a/apiProject/app.js b/apiProject/app.js new file mode 100644 index 0000000..114ac60 --- /dev/null +++ b/apiProject/app.js @@ -0,0 +1,30 @@ +let url = "http://universities.hipolabs.com/search?country=india"; + +let btn = document.querySelector("button"); +btn.addEventListener("click", async() =>{ + let state = document.querySelector("input").value; + let colArr = await getCollege(state); + show(colArr); +}) +function show(colArr){ + let list = document.querySelector("ul"); + list.innerText = ""; + for(col of colArr){ + let li = document.createElement("li"); + list.appendChild(li); + li.innerText = col.name; + } +} +async function getCollege(state) { + try{ + let res = await axios.get(url); + let filtered = res.data.filter(col => + col["state-province"] && + col["state-province"].toLowerCase().includes(state.toLowerCase()) + ); + return filtered; + }catch(e){ + console.log(e); + return []; + } +} \ No newline at end of file diff --git a/apiProject/index.html b/apiProject/index.html new file mode 100644 index 0000000..023c1d0 --- /dev/null +++ b/apiProject/index.html @@ -0,0 +1,22 @@ + + +
+ + +