chore: set content-type in the module
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Has been cancelled

This commit is contained in:
Edward Langley
2025-11-15 19:08:44 -08:00
parent 4cae73faf6
commit a92a67eaa2
2 changed files with 15 additions and 18 deletions

View File

@ -32,15 +32,15 @@ http {
server {
listen 8080;
server_name localhost;
root "server_root";
charset utf-8;
# Serve static CSS file
location /static/ {
add_header "Content-Type" "text/css; charset=utf-8";
add_header "Cache-Control" "public, max-age=31536000";
}
# # Serve static CSS file
# location /static/ {
# add_header "Content-Type" "text/css; charset=utf-8";
# add_header "Cache-Control" "public, max-age=31536000";
# }
# Homepage - Redirect to catalog
location = / {
@ -49,7 +49,7 @@ http {
# Browse all books
location = /books {
add_header "Content-Type" "text/html; charset=utf-8";
# add_header "Content-Type" "text/html; charset=utf-8";
add_header "Cache-Control" "public, max-age=300";
sqlite_db "book_catalog.db";
sqlite_query "SELECT * FROM books ORDER BY rating DESC, title";
@ -58,7 +58,7 @@ http {
# Book detail by ID (named parameter)
location = /book {
add_header "Content-Type" "text/html; charset=utf-8";
# add_header "Content-Type" "text/html; charset=utf-8";
add_header "Cache-Control" "public, max-age=300";
sqlite_db "book_catalog.db";
sqlite_query "SELECT * FROM books WHERE id = :book_id";
@ -68,7 +68,6 @@ http {
# Filter by genre (named parameter)
location = /genre {
add_header "Content-Type" "text/html; charset=utf-8";
add_header "Cache-Control" "public, max-age=300";
sqlite_db "book_catalog.db";
sqlite_query "SELECT * FROM books WHERE genre = :genre ORDER BY rating DESC, title";
@ -78,7 +77,6 @@ http {
# Search by title (named parameter with LIKE)
location = /search {
add_header "Content-Type" "text/html; charset=utf-8";
sqlite_db "book_catalog.db";
sqlite_query "SELECT * FROM books WHERE title LIKE '%' || :q || '%' ORDER BY rating DESC";
sqlite_param :q $arg_q;
@ -87,7 +85,6 @@ http {
# Filter by minimum rating (named parameter)
location = /top {
add_header "Content-Type" "text/html; charset=utf-8";
sqlite_db "book_catalog.db";
sqlite_query "SELECT * FROM books WHERE rating >= :min_rating ORDER BY rating DESC, title";
sqlite_param :min_rating $arg_min;
@ -96,7 +93,6 @@ http {
# Year range filter (multiple named parameters)
location = /era {
add_header "Content-Type" "text/html; charset=utf-8";
sqlite_db "book_catalog.db";
sqlite_query "SELECT * FROM books WHERE year >= :from AND year <= :to ORDER BY year DESC, title";
sqlite_param :from $arg_from;
@ -111,4 +107,3 @@ http {
}
}
}