test: middleware/parameter

This commit is contained in:
DIYgod
2019-01-29 18:54:30 +08:00
parent 42ed46532b
commit 8cec57eaec
2 changed files with 110 additions and 14 deletions

View File

@@ -87,23 +87,20 @@ router.get('/', async (ctx) => {
});
router.get('/test/:id', (ctx) => {
const item = [];
for (let i = 1; i < 6; i++) {
item.push({
title: `Title${i}`,
description: `Item${i}`,
pubDate: new Date(`2018-4-${i}`).toUTCString(),
link: `https://github.com/DIYgod/RSSHub/issues/${i}`,
author: `DIYgod${i}`,
});
}
ctx.state.data = {
title: `Test ${ctx.params.id}`,
link: 'https://github.com/DIYgod/RSSHub',
item: [
{
title: 'Title1',
description: 'Item1',
pubDate: new Date('2018-4-2').toUTCString(),
link: 'https://github.com/DIYgod/RSSHub/issues/1',
},
{
title: 'Title2',
description: 'Item2',
pubDate: new Date('2018-4-10').toUTCString(),
link: 'https://github.com/DIYgod/RSSHub/issues/2',
},
],
item: item,
};
});