ResMan update
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
const express = require("express")
|
||||
const router = express.Router()
|
||||
const db = require("../db")
|
||||
|
||||
/* alle Subdomains laden */
|
||||
|
||||
router.get("/", async (req,res)=>{
|
||||
|
||||
try{
|
||||
|
||||
const [rows] = await db.query(`
|
||||
SELECT
|
||||
s.id,
|
||||
s.subdomain,
|
||||
s.ip_address,
|
||||
d.domain_name,
|
||||
s.domain_id
|
||||
FROM subdomains s
|
||||
JOIN domains d ON s.domain_id=d.id
|
||||
`)
|
||||
|
||||
res.json(rows)
|
||||
|
||||
}catch(e){
|
||||
|
||||
console.error("SUBDOMAIN LIST error:",e)
|
||||
res.status(500).json({error:"DB error"})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
/* Subdomains einer Domain */
|
||||
|
||||
router.get("/domain/:id", async (req,res)=>{
|
||||
|
||||
try{
|
||||
|
||||
const [rows] = await db.query(
|
||||
"SELECT * FROM subdomains WHERE domain_id=?",
|
||||
[req.params.id]
|
||||
)
|
||||
|
||||
res.json(rows)
|
||||
|
||||
}catch(e){
|
||||
|
||||
console.error("SUBDOMAIN DOMAIN error:",e)
|
||||
res.status(500).json({error:"DB error"})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
Reference in New Issue
Block a user