Search code examples
jsonangularwebarticle

Building an Angular app that hosts articles using JSON files?


I am working on an Angular application (using Angular 9) to build out a website that has articles written by my organization. I would be publishing the articles on my own time after reviewing their emailed submissions to me. I am thinking of using JSON files for each article, structured as such:

[
    {
        "id": 1,
        "title": "Test Title",
        "author": "Test Author",
        "disclaimer": "Test Disclaimer",
        "body": "Test Body"
    }
]

I am not sure if the id field is necessary but I saw it being used on a lot of JSON/Angular demos online so I thought I would include it as a unique identifier to each JSON file. Does anyone have any resources on how I can take these JSON files to create and format articles for my website? Any links to examples and resources would be helpful. I have been trying to find some but have had no luck. Thank you.


Solution

  • Well it up to you what all things you need to display. Your format looks good.

    According to me following things need to maintained

    • Unique id
    • Title
    • author
    • Article itself
    • votes(if you are maintaining)
    • dateCreated

    But any other schema will work as it varies application to application