First of all, thx for your greate tool. I'm playing arround with it and have a issue that i couldn't solve.
I read the article from CSS Tricks.
I create a source folder with the following structure:
source
slogan1.yaml
slogan2.yaml
the structure of slogan is only
author: "Hugo"
slogan: "Lorem ipsum ..."
I want to generate the following endpoint
/slogans
The Code of my server.js:
const API = require('static-api-generator')
const slogansAPI = new API({
blueprint: 'source/:slogan',
outputPath: 'output'
})
slogansAPI.generate({
endpoints: ['slogans'],
})
After generating it with npm start I get 2 json files
Can you tell me what I'm doing wrong. The strange thing ist the content of slogans.json. It contains two result objects?
The content of .json seems right, but why is there no filename?
Content of slogans.json
{
"results": [
{
"results": [
{
"undefined_id": "10c8f19f2d98c3eb66ec911b5dc5abd0",
"author": "Hugo",
"title": "Lorem ipsum"
},
{
"undefined_id": "dfbdfa8f69d0b629153207a17e565fd9",
"author": "Hugo",
"slogan": "Lorem ipsum dolor"
}
]
}
],
"metadata": {
"itemsPerPage": 10,
"pages": 1
}
}
Content of .json
{
"results": [
{
"undefined_id": "10c8f19f2d98c3eb66ec911b5dc5abd0",
"author": "Hugo",
"title": "Lorem ipsum"
},
{
"undefined_id": "dfbdfa8f69d0b629153207a17e565fd9",
"author": "Hugo",
"slogan": "Lorem ipsum dolor"
}
],
"metadata": {
"itemsPerPage": 10,
"pages": 1
}
}
First of all, thx for your greate tool. I'm playing arround with it and have a issue that i couldn't solve.
I read the article from CSS Tricks.
I create a source folder with the following structure:
the structure of slogan is only
author: "Hugo"
slogan: "Lorem ipsum ..."
I want to generate the following endpoint
/slogans
The Code of my
server.js:After generating it with npm start I get 2 json files
Can you tell me what I'm doing wrong. The strange thing ist the content of slogans.json. It contains two result objects?
The content of .json seems right, but why is there no filename?
Content of slogans.json
{ "results": [ { "results": [ { "undefined_id": "10c8f19f2d98c3eb66ec911b5dc5abd0", "author": "Hugo", "title": "Lorem ipsum" }, { "undefined_id": "dfbdfa8f69d0b629153207a17e565fd9", "author": "Hugo", "slogan": "Lorem ipsum dolor" } ] } ], "metadata": { "itemsPerPage": 10, "pages": 1 } }Content of .json
{ "results": [ { "undefined_id": "10c8f19f2d98c3eb66ec911b5dc5abd0", "author": "Hugo", "title": "Lorem ipsum" }, { "undefined_id": "dfbdfa8f69d0b629153207a17e565fd9", "author": "Hugo", "slogan": "Lorem ipsum dolor" } ], "metadata": { "itemsPerPage": 10, "pages": 1 } }