module.exports = { index: async ctx => { const result = await strapi .query('teks') .model.find({published_at: {$ne: null}}) const sortedResult = result.sort((a, b) => { const aDate = new Date(a.published_at) const bDate = new Date(b.published_at) return bDate.getTime() - aDate.getTime() }) ctx.send(sortedResult.map(({slug}) => slug)); } }