Added lanes (first try)
This commit is contained in:
23
frontend/server/api/champions.js
Normal file
23
frontend/server/api/champions.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import {connectToDatabase, fetchLatestPatch} from '../utils/mongo'
|
||||
|
||||
async function champions(client, patch) {
|
||||
const database = client.db("champions");
|
||||
const collection = database.collection(patch);
|
||||
const data = await collection.find().toArray()
|
||||
data.map((x) => {
|
||||
delete x.runes
|
||||
delete x.builds
|
||||
})
|
||||
return data
|
||||
}
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const client = await connectToDatabase();
|
||||
const latestPatch = await fetchLatestPatch(client);
|
||||
|
||||
const data = await champions(client, latestPatch);
|
||||
|
||||
await client.close()
|
||||
|
||||
return data
|
||||
})
|
||||
Reference in New Issue
Block a user