Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New API] : School & College Api #338

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions New_APIs/Scool-College-api/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# School & College Rating API

## Author
sivaprasath2004

## Description
This API provides a comprehensive system for retrieving and managing ratings for schools and colleges. It allows users to search and filter educational institutions based on various criteria such as ID, name, city, location, and rating. This API is ideal for developers who need to integrate school and college rating data into their applications, ensuring they have access to up-to-date and accurate information. The API supports multiple endpoints to facilitate detailed and flexible queries, making it a powerful tool for education-related projects.

## Routes

### School
- Get all schools: `GET /school`
- Get a specific school by ID: `GET /school/id/:id`
- Get a specific school by name: `GET /school/name/:name`
- Get a specific school by city: `GET /school/city/:city`
- Get a specific school by location: `GET /school/location/:location`
- Get a specific school by rating: `GET /school/rating/:rating`

### College
- Get all colleges: `GET /college`
- Get a specific college by ID: `GET /college/id/:id`
- Get a specific college by name: `GET /college/name/:name`
- Get a specific college by city: `GET /college/city/:city`
- Get a specific college by location: `GET /college/location/:location`
- Get a specific college by rating: `GET /college/rating/:rating`

## Statistics
- Number of schools: 140+
- Number of colleges: 200+

## Output

![Screenshot from 2024-07-22 08-15-14](https://github.com/user-attachments/assets/ac21b1d6-8104-4508-b155-8f7bedec65bb)

![Screenshot from 2024-07-22 08-14-51](https://github.com/user-attachments/assets/821b2872-1a80-40a0-b7d1-00cb63a9caa4)

![Screenshot from 2024-07-22 08-15-04](https://github.com/user-attachments/assets/4162d3c9-c9cb-40db-88fb-f7f5e1207f38)

![Screenshot from 2024-07-22 08-14-21](https://github.com/user-attachments/assets/d03666f5-2893-43b6-938c-0abfb8e0e700)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
374 changes: 374 additions & 0 deletions New_APIs/Scool-College-api/asset/data.js

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions New_APIs/Scool-College-api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
const express=require("express")
const app=express()
const cors=require('cors')
const {School,College}=require('./asset/data')
app.use(cors())
app.get("/",(req,res)=>{
res.send({
title:"school & college rating api",
author:"sivaprasath2004",
Routes:{
school:{
all:"/school",
Specific_school_id:"/school/id/:id",
Specific_school_name:"/school/name/:name",
Specific_school_city:"/school/city/:city",
Specific_school_location:"/school/location/:location",
Specific_school_rating:"/school/rating/:rating",
},
college:{
all:"/college",
specific_college_id:"/college/id/:id",
specific_college_name:"/college/name/:name",
specific_college_city:"/college/city/:city",
specific_college_location:"/college/location/:location",
specific_college_rating:"/college/rating/:rating"
},
},
school_count:"140+",
college_count:"200+"
})
})
app.get("/school",(req,res)=>{
res.send(School)
})
app.get("/college",(req,res)=>{
res.send(College)
})
app.get("/:category/:type",(req,res)=>{
if(req.params.category==="school"){
res.send(School)
}
else if(req.params.category==="college"){
res.send(College)
}
else{
res.send(`no results found on the ${req.params.category}`)
}
})
app.get("/:category/:type/:data",(req,res)=>{
if(req.params.category==="school"){
let finder=School.filter((item)=> req.params.type=="id"?item[req.params.type]==req.params.data:item[req.params.type].toLowerCase()==req.params.data.toLowerCase())
if(finder.length>0){
res.send(finder)
}
else{
res.send("no more match results")
}
}
else if(req.params.category==="college"){
let finder=College.filter((item)=> req.params.type=="id"?item[req.params.type]==req.params.data:item[req.params.type].toLowerCase()==req.params.data.toLowerCase())
if(finder.length>0){
res.send(finder)
}
else{
res.send("no more match results")
}
}else{
res.send(`no results found on the ${req.params.category}`)
}
})
app.listen(5000,()=>{console.log('app listen in 5000')})
Loading
Loading