Skip to content

Commit

Permalink
update test function to have more data
Browse files Browse the repository at this point in the history
  • Loading branch information
moonmeister committed Aug 30, 2021
1 parent c3961cf commit f84e56e
Showing 1 changed file with 319 additions and 7 deletions.
326 changes: 319 additions & 7 deletions packages/gatsby-plugin-fastify/test-site/src/api/test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,321 @@
export default function handler(req, res) {
console.log("We're in our function!!");

if (typeof res.statusCode === "function") {
res.statusCode(200).json({ hello: `world` });
} else {
res.code(200).send({ hello: `world` });
const responseData = [
{
"_id": "612d652f43f0c05240ed09b1",
"index": 0,
"guid": "ced90cbd-3fad-4c66-bd8d-678eebb3f319",
"isActive": true,
"balance": "$3,289.14",
"picture": "http://placehold.it/32x32",
"age": 34,
"eyeColor": "blue",
"name": "Mcclure Cohen",
"gender": "male",
"company": "ONTALITY",
"email": "mcclurecohen@ontality.com",
"phone": "+1 (876) 555-3658",
"address": "933 Conklin Avenue, Joes, Indiana, 9109",
"about": "Do labore fugiat exercitation esse commodo dolor voluptate proident ullamco mollit eu. Dolor aliqua incididunt ex consectetur qui labore in laborum dolore mollit fugiat. Occaecat nisi ea nulla deserunt dolore aliqua consequat ipsum fugiat aliqua est sunt anim cillum. Nulla culpa dolore reprehenderit quis aliquip.\r\n",
"registered": "2016-03-02T03:01:11 +08:00",
"latitude": -13.438572,
"longitude": 116.414307,
"tags": [
"Lorem",
"dolore",
"anim",
"mollit",
"ullamco",
"magna",
"elit"
],
"friends": [
{
"id": 0,
"name": "Burnett Farley"
},
{
"id": 1,
"name": "Glenn Osborn"
},
{
"id": 2,
"name": "Berry Schwartz"
}
],
"greeting": "Hello, Mcclure Cohen! You have 7 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "612d652f366d8330fa996824",
"index": 1,
"guid": "7101122e-8cea-4a02-b1b8-ae910c0802af",
"isActive": false,
"balance": "$3,387.50",
"picture": "http://placehold.it/32x32",
"age": 32,
"eyeColor": "blue",
"name": "Geneva Valdez",
"gender": "female",
"company": "LIQUICOM",
"email": "genevavaldez@liquicom.com",
"phone": "+1 (974) 495-2314",
"address": "615 Waldorf Court, Belleview, New Jersey, 4579",
"about": "Sint anim sunt enim ea ea exercitation officia adipisicing aute. Cillum aliquip dolor mollit sunt sint. Sint excepteur sit ut eu culpa aute voluptate est non est sint do nostrud ut. Nostrud officia amet consectetur exercitation aliquip nulla occaecat. Irure voluptate aute irure quis aute ipsum.\r\n",
"registered": "2019-10-23T07:06:59 +07:00",
"latitude": 4.157784,
"longitude": 79.800439,
"tags": [
"Lorem",
"enim",
"sint",
"commodo",
"minim",
"tempor",
"consectetur"
],
"friends": [
{
"id": 0,
"name": "Teri Crane"
},
{
"id": 1,
"name": "Colleen Burns"
},
{
"id": 2,
"name": "Pierce Stafford"
}
],
"greeting": "Hello, Geneva Valdez! You have 5 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "612d652fac8efd8e645f7305",
"index": 2,
"guid": "9e49d2b8-2684-4a2b-8d34-2db63470105e",
"isActive": true,
"balance": "$1,648.73",
"picture": "http://placehold.it/32x32",
"age": 39,
"eyeColor": "green",
"name": "Beth Pitts",
"gender": "female",
"company": "QUIZKA",
"email": "bethpitts@quizka.com",
"phone": "+1 (967) 452-3934",
"address": "209 Elm Avenue, Soham, South Dakota, 6752",
"about": "Excepteur est et cupidatat id nisi quis occaecat est non cillum. Dolore aliquip elit aliquip exercitation anim ad aliqua sint enim mollit anim. Nulla veniam amet labore consectetur nulla non culpa laboris non ea. Irure fugiat fugiat reprehenderit aute labore. Commodo enim velit sit sunt in eu adipisicing proident aliqua sit officia. Et cupidatat mollit est voluptate adipisicing ullamco ullamco. Elit in sint velit laboris fugiat.\r\n",
"registered": "2018-07-10T08:23:13 +07:00",
"latitude": -41.232792,
"longitude": 14.620843,
"tags": [
"ipsum",
"voluptate",
"reprehenderit",
"fugiat",
"nulla",
"elit",
"dolore"
],
"friends": [
{
"id": 0,
"name": "Rosa Case"
},
{
"id": 1,
"name": "Charlene Wilkinson"
},
{
"id": 2,
"name": "Wilcox Shannon"
}
],
"greeting": "Hello, Beth Pitts! You have 4 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "612d652f86b888292e0537ea",
"index": 3,
"guid": "ae58b78c-46a4-4a09-b636-d86ebc84870c",
"isActive": false,
"balance": "$1,820.92",
"picture": "http://placehold.it/32x32",
"age": 38,
"eyeColor": "blue",
"name": "Mack Parker",
"gender": "male",
"company": "GRONK",
"email": "mackparker@gronk.com",
"phone": "+1 (942) 455-3698",
"address": "340 Village Court, Spokane, Iowa, 7827",
"about": "Officia occaecat eu duis officia amet in ea ad mollit ut. Mollit non anim ex do. In esse commodo esse ullamco irure laborum officia enim deserunt et. Ut adipisicing aliqua qui anim fugiat duis magna culpa aliqua nisi ex tempor Lorem cupidatat. Aute Lorem ut fugiat reprehenderit fugiat velit. Eu occaecat esse sit anim ad.\r\n",
"registered": "2017-10-26T05:06:57 +07:00",
"latitude": 62.176215,
"longitude": 50.081649,
"tags": [
"eiusmod",
"esse",
"adipisicing",
"deserunt",
"minim",
"dolor",
"sint"
],
"friends": [
{
"id": 0,
"name": "Corinne Cleveland"
},
{
"id": 1,
"name": "Janell Stevenson"
},
{
"id": 2,
"name": "Ruiz Dalton"
}
],
"greeting": "Hello, Mack Parker! You have 5 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "612d652f918c5464a5d1badc",
"index": 4,
"guid": "16de477f-8260-4dbf-803a-0b9af672a7a3",
"isActive": false,
"balance": "$2,015.74",
"picture": "http://placehold.it/32x32",
"age": 40,
"eyeColor": "brown",
"name": "Benton Garza",
"gender": "male",
"company": "CODACT",
"email": "bentongarza@codact.com",
"phone": "+1 (978) 544-3959",
"address": "723 Linden Street, Loma, Hawaii, 2183",
"about": "Veniam voluptate eiusmod est exercitation magna dolor cillum veniam. Anim culpa veniam adipisicing consequat sint adipisicing. Minim velit eu tempor enim nulla enim adipisicing id elit irure ex. Voluptate duis cupidatat fugiat amet dolore veniam. Adipisicing ad occaecat velit cillum.\r\n",
"registered": "2016-05-12T08:32:44 +07:00",
"latitude": 41.639383,
"longitude": -33.102296,
"tags": [
"excepteur",
"et",
"duis",
"velit",
"laboris",
"pariatur",
"dolor"
],
"friends": [
{
"id": 0,
"name": "Ryan Waters"
},
{
"id": 1,
"name": "Robbie Rosario"
},
{
"id": 2,
"name": "Gracie Freeman"
}
],
"greeting": "Hello, Benton Garza! You have 1 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "612d652f1dd2eb98a16e0a3d",
"index": 5,
"guid": "856875e2-24fa-426c-a1cd-5447ea2abeb9",
"isActive": false,
"balance": "$1,889.99",
"picture": "http://placehold.it/32x32",
"age": 37,
"eyeColor": "brown",
"name": "Tommie Durham",
"gender": "female",
"company": "EVIDENDS",
"email": "tommiedurham@evidends.com",
"phone": "+1 (866) 570-3407",
"address": "694 Barlow Drive, Lithium, Tennessee, 1100",
"about": "Enim nostrud ea ea quis. Commodo commodo reprehenderit ea minim officia enim. Velit laboris incididunt commodo esse commodo ea excepteur in deserunt deserunt. Fugiat ad exercitation aliqua minim ea sunt pariatur est commodo sunt nisi ex. Ipsum ad enim ut et culpa pariatur.\r\n",
"registered": "2018-03-01T06:21:31 +08:00",
"latitude": 52.298302,
"longitude": -22.076203,
"tags": [
"laboris",
"labore",
"officia",
"in",
"est",
"deserunt",
"ad"
],
"friends": [
{
"id": 0,
"name": "Francis Park"
},
{
"id": 1,
"name": "Schmidt Williamson"
},
{
"id": 2,
"name": "Adkins Shields"
}
],
"greeting": "Hello, Tommie Durham! You have 6 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "612d652f8e1b1bc30f3585ec",
"index": 6,
"guid": "eb70d15e-fee8-4e76-8c90-049d3d6dac43",
"isActive": false,
"balance": "$1,139.14",
"picture": "http://placehold.it/32x32",
"age": 21,
"eyeColor": "brown",
"name": "Lee Good",
"gender": "male",
"company": "LIMAGE",
"email": "leegood@limage.com",
"phone": "+1 (945) 414-3105",
"address": "652 Hendrickson Street, Wilsonia, Arizona, 9156",
"about": "Amet ullamco adipisicing velit cillum quis minim nulla sint dolor. Labore magna quis nulla occaecat cupidatat anim irure. Anim duis nisi ipsum sint.\r\n",
"registered": "2017-10-14T04:22:31 +07:00",
"latitude": 85.591186,
"longitude": 51.21934,
"tags": [
"ipsum",
"ad",
"exercitation",
"mollit",
"magna",
"irure",
"elit"
],
"friends": [
{
"id": 0,
"name": "Delacruz Vaughn"
},
{
"id": 1,
"name": "Kari Figueroa"
},
{
"id": 2,
"name": "Kris Marsh"
}
],
"greeting": "Hello, Lee Good! You have 7 unread messages.",
"favoriteFruit": "strawberry"
}
]

export default function handler(req, res) {
res.code(200).send(responseData);
}

0 comments on commit f84e56e

Please sign in to comment.