Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/api/images/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ function handler(pathName: string) {
http.get(`/${pathName}`, () => {
const images = fs.readdirSync('./src/resources/images');
return HttpResponse.text(
`<body style="background-color: #383838; color:white">
`<style>a {color: lightblue; text-decoration: none} a:hover {text-decoration: underline}</style>
<body style="background-color: #383838; color:white">
<div style="text-align:center; padding:50px 0px 0px 0px">
<h4>Access images stored in the src/resources/images folder using the format: <span style="color:red">api/images/{filename}</span></h4>
<h4>Access images stored in the src/resources/images folder using the format: <span style="color:pink">api/images/{filename}</span></h4>
<h4>Resize images by adding url paramters E.g placeholder.png?height=500&width=500</h4>

<h4>Get a full list of images as a json object at <a href="/api/images/list">/images/list</a> </h4>
<h4>Available image files in src/resources/images folder:</h4>
<div>${images.map((image) => `<a href="/api/images/${image}">${image}</a></p>`).join('')}<div>
<div>${images.map((image) => `<p><a href="/api/images/${image}" >${image}</a></p>`).join('')}<div>
</div>
</body>
`,
Expand Down
5 changes: 3 additions & 2 deletions src/api/videos/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ function handler(pathName: string) {
http.get(`/${pathName}`, ({ request: _request }) => {
const videos = fs.readdirSync('./src/resources/videos');
return HttpResponse.text(
`<body style="background-color: #383838; color:white">
`<style>a {color: lightblue; text-decoration: none} a:hover {text-decoration: underline}</style>
<body style="background-color: #383838; color:white">
<div style="text-align:center; padding:50px 0px 0px 0px">
<h4>Access videos stored in the src/resources/videos folder using the format: <span style="color:red">api/videos/{filename}</span></h4>
<h4>Access videos stored in the src/resources/videos folder using the format: <span style="color:pink">api/videos/{filename}</span></h4>
<h4>Example: api/videos/placeholder.mp4</h4>
<h4>Get a full list of videos as a json object at <a href="/api/videos/list">/videos/list</a> </h4>
<h4>Available video files in src/resources/videos folder:</h4>
Expand Down