Add redirects to png
This commit is contained in:
parent
c4faf11b38
commit
026b056e7a
1 changed files with 10 additions and 2 deletions
12
index.js
12
index.js
|
@ -8,7 +8,7 @@ const { CardCreator } = require('./create-card');
|
|||
const creator = new CardCreator();
|
||||
creator.init();
|
||||
|
||||
app.get('/characters/id/:charaId', async (req, res) => {
|
||||
app.get('/characters/id/:charaId.png', async (req, res) => {
|
||||
try {
|
||||
const png = await creator.createCard(req.params.charaId);
|
||||
|
||||
|
@ -23,7 +23,11 @@ app.get('/characters/id/:charaId', async (req, res) => {
|
|||
}
|
||||
})
|
||||
|
||||
app.get('/characters/name/:world/:charName', async (req, res) => {
|
||||
app.get('/characters/id/:charaId', async (req, res) => {
|
||||
res.redirect(`/characters/id/${req.params.charaId}.png`);
|
||||
})
|
||||
|
||||
app.get('/characters/name/:world/:charName.png', async (req, res) => {
|
||||
var response = await fetch(`https://xivapi.com/character/search?name=${req.params.charName}&server=${req.params.world}`);
|
||||
var data = await response.json();
|
||||
|
||||
|
@ -47,6 +51,10 @@ app.get('/characters/name/:world/:charName', async (req, res) => {
|
|||
}
|
||||
})
|
||||
|
||||
app.get('/characters/name/:world/:charName', async (req, res) => {
|
||||
res.redirect(`/characters/name/${req.params.world}/${req.params.charName}.png`);
|
||||
})
|
||||
|
||||
app.get('/', async (req, res) => {
|
||||
res.redirect('https://github.com/ArcaneDisgea/XIV-Character-Cards');
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue