dynamic-content-delivery-api/README.md
2024-06-05 09:56:57 -05:00

1.8 KiB

Dynamic Content Delivery API

API template for Dynamic Content Delivery - HTML page that provides data to the user based on the given ID.

Which files am I allowed to edit?

How to use

  1. Clone this repository.
  2. Install Node.js and npm.
  3. Install dependencies:
    npm install
    
  4. Edit required files:
    1. config.json:
      • edit your constants:
        1. provide your API port in PORT constant.
    2. data-source.json:
      • provide your data in DATA constant like this:
      {
          "id1": {
              "#name": {
                  "textContent": "John",
                  "style": {
                      "color": "red"
                  }
              }
          },
          "id2": {
              "#name": {
                  "textContent": "Anna",
                  "style": {
                      "color": "blue"
                  }
              }
          }
      }
      
      

      Warning

      Do not change the structure of the DATA object. It must be an object with keys being IDs and values, which are objects with CSS selectors as keys and objects with DOM properties as values. Make sure that your API is running on the same port as the one provided in PORT constant.

  5. Run the API:
    npm start
    

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors