Open History to see the last commit
1import fetch from 'isomorphic-unfetch'
2β
3const projects = [
4 'tannerlinsley/react-query',
5 'tannerlinsley/react-table',
6 'facebook/react',
7 'zeit/next.js',
8]
9β
10export default (req, res) => {
11 if (req.query.id) {
12 // a slow endpoint for getting repo data
13 fetch(`https://api.github.com/repos/${req.query.id}`)
14 .then((resp) => resp.json())
15 .then((data) => {
16 setTimeout(() => {
17 res.json(data)
18 }, 2000)
19 })
20β
21 return
22 }
23 setTimeout(() => {
24 res.json(projects)
25 }, 2000)
26}