Skip to content

Commit

Permalink
Create modelController.js
Browse files Browse the repository at this point in the history
  • Loading branch information
DomathID committed Jun 20, 2024
1 parent 5f03123 commit 68efd51
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions controllers/modelController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const axios = require('axios');

const baseURL = 'https://live2d.nekochan.eu.org';

async function getModel(req, res) {
const modelName = req.params.modelName;
const modelUrl = `${baseURL}/${modelName}/model.json`;

try {
const response = await axios.get(modelUrl);
res.json(response.data);
} catch (error) {
console.error('Error fetching model.json:', error.message);
res.status(500).json({ error: 'Failed to fetch model.json' });
}
}

module.exports = { getModel };

0 comments on commit 68efd51

Please sign in to comment.