Spaces:
Build error
Build error
Upload pages/api/nodes.js with huggingface_hub
Browse files- pages/api/nodes.js +17 -0
pages/api/nodes.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export default function handler(req, res) {
|
| 2 |
+
if (req.method === 'GET') {
|
| 3 |
+
res.status(200).json({ message: 'Nodes API endpoint' })
|
| 4 |
+
} else if (req.method === 'POST') {
|
| 5 |
+
const { name, type, model, apiKey, brief } = req.body
|
| 6 |
+
res.status(201).json({
|
| 7 |
+
id: `node-${Date.now()}`,
|
| 8 |
+
name,
|
| 9 |
+
type,
|
| 10 |
+
model,
|
| 11 |
+
apiKey,
|
| 12 |
+
brief
|
| 13 |
+
})
|
| 14 |
+
} else {
|
| 15 |
+
res.status(405).json({ message: 'Method not allowed' })
|
| 16 |
+
}
|
| 17 |
+
}
|