Skip to content

Commit

Permalink
feat(http/sitemaps): implement sitemaps mock endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Jan 16, 2024
1 parent 11dfdd3 commit a1959e5
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Please see [Qualtet's REST API docs](https://yoshinorin.github.io/qualtet/rest-a
- [ ] `/search`
- [x] `/series`
- [ ] `/series/{seriesName}`
- [ ] `/sitemaps`
- [x] `/sitemaps/`
- [x] `/system/health`
- [x] `/system/metadata`
- [x] `/tags`
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use services::{
contents::{content_with_trailing_slash, content_without_trailing_slash},
index::index,
series::series,
sitemaps::sitemaps,
system::{health, metadata},
tags::{tag_a, tags},
};
Expand All @@ -33,6 +34,7 @@ async fn main() -> std::io::Result<()> {
.service(content_with_trailing_slash)
.service(content_without_trailing_slash)
.service(series)
.service(sitemaps)
.service(health)
.service(metadata)
.service(tags)
Expand Down
46 changes: 46 additions & 0 deletions src/resources/sitemaps/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[
{
"loc": "/articles/nested/standard/",
"lastMod": "2023-12-27"
},
{
"loc": "/articles/nested/empty-robots/",
"lastMod": "2023-12-26"
},
{
"loc": "/articles/nested/empty-tags/",
"lastMod": "2023-12-25"
},
{
"loc": "/articles/2016/07/13/csharp-file-hash-value/",
"lastMod": "2023-12-13"
},
{
"loc": "/articles/nested/partially-robots/",
"lastMod": "2023-12-12"
},
{
"loc": "/articles/nested/with-externalresources/",
"lastMod": "2023-12-11"
},
{
"loc": "/articles/nested/without-robots/",
"lastMod": "2023-12-10"
},
{
"loc": "/articles/nested/without-tags/",
"lastMod": "2023-12-09"
},
{
"loc": "/articles/2023/12/08/gravida/",
"lastMod": "2023-12-08"
},
{
"loc": "/articles/2023/12/07/vestibulum/",
"lastMod": "2023-12-07"
},
{
"loc": "/articles/2023/12/06/sodales/",
"lastMod": "2023-12-06"
}
]
1 change: 1 addition & 0 deletions src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ pub mod articles;
pub mod contents;
pub mod index;
pub mod series;
pub mod sitemaps;
pub mod system;
pub mod tags;
8 changes: 8 additions & 0 deletions src/services/sitemaps.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use crate::utils;
use actix_web::{get, Error, HttpResponse};

#[get("/sitemaps/")]
pub async fn sitemaps() -> Result<HttpResponse, Error> {
let content = utils::readfile("./src/resources/sitemaps/index.json")?;
utils::make_ok_response(content)
}

0 comments on commit a1959e5

Please sign in to comment.