dynamic-content-delivery-api/README.md

56 lines
1.8 KiB
Markdown
Raw Permalink Normal View History

2024-03-10 07:38:06 -05:00
## Dynamic Content Delivery API
2024-04-29 11:26:20 -05:00
API template for [Dynamic Content Delivery](https://git.sador.me/sadorowo/dynamic-content-delivery) - HTML page that provides data to the user based on the given ID.
2024-03-10 07:38:06 -05:00
## Which files am I allowed to edit?
- all files in `data` directory:
- [config.json](data/config.json)
- [data-source.json](data/data-source.json)
## How to use
1. Clone this repository.
2. Install Node.js and npm.
3. Install dependencies:
```bash
npm install
```
4. Edit required files:
2024-04-29 11:26:20 -05:00
1. **[config.json](data/config.json)**:
2024-03-10 07:38:06 -05:00
- edit your constants:
1. provide your API port in `PORT` constant.
2024-04-29 11:26:20 -05:00
2. **[data-source.json](data/data-source.json)**:
2024-03-10 07:38:06 -05:00
- provide your data in `DATA` constant like this:
```json
{
"id1": {
"#name": {
"textContent": "John",
"style": {
"color": "red"
}
}
},
"id2": {
"#name": {
"textContent": "Anna",
"style": {
"color": "blue"
}
}
}
}
```
2024-06-05 09:56:57 -05:00
> [!WARNING]
2024-03-10 07:38:06 -05:00
> 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:
```bash
npm start
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Authors
2024-04-29 11:26:20 -05:00
- [**@sadorowo**](https://git.sador.me/sadorowo) - original author