started working on routing

This commit is contained in:
ngn
2023-06-11 00:22:06 +03:00
parent 1327813462
commit b2989becd3
8 changed files with 70 additions and 33 deletions

12
api/routes/resources.js Normal file
View File

@ -0,0 +1,12 @@
const express = require("express")
const resources = express.Router()
resources.get("/get", async (req,res)=>{
await req.db.connect()
const col = await req.db.collection("ngn13")
const results = col.find().limit(10).toArray()
await req.db.close()
res.json({ error: 0, resources: results })
})
module.exports = resources