this repo has no description

use more consistent url path names

authored by reykjalin.org and committed by rockorager.dev 5707ed31 7015fcb6

+6 -6
+5 -5
src/main.zig
··· 2049 2049 var router = try server.router(.{}); 2050 2050 router.get("/", getIndex, .{}); 2051 2051 router.get("/assets/:type/:name", getAsset, .{}); 2052 - router.get("/channel/:channel", getChannel, .{}); 2053 - router.get("/channel/:channel/messages", getChannelMessages, .{}); 2054 - router.post("/channel", goToChannel, .{}); 2052 + router.get("/channels/:channel", getChannel, .{}); 2053 + router.get("/channels/:channel/messages", getChannelMessages, .{}); 2054 + router.post("/channels", goToChannel, .{}); 2055 2055 router.get("/channels", getChannels, .{}); 2056 2056 2057 2057 log.info("HTTP server listening on http://localhost:8080", .{}); ··· 2125 2125 defer list.deinit(res.arena); 2126 2126 2127 2127 for (ctx.channels.keys()) |name| { 2128 - const html_item = try std.fmt.allocPrint(res.arena, "<li><a href=\"/channel/{s}\">{s}</a></li>", .{ name[1..], name }); 2128 + const html_item = try std.fmt.allocPrint(res.arena, "<li><a href=\"/channels/{s}\">{s}</a></li>", .{ name[1..], name }); 2129 2129 try list.appendSlice(res.arena, html_item); 2130 2130 } 2131 2131 ··· 2144 2144 2145 2145 if (channel) |ch| { 2146 2146 if (ctx.hasChannel(ch)) { 2147 - const url = try std.fmt.allocPrint(res.arena, "/channel/{s}", .{ch}); 2147 + const url = try std.fmt.allocPrint(res.arena, "/channels/{s}", .{ch}); 2148 2148 res.status = 302; 2149 2149 res.header("Location", url); 2150 2150 return;
+1 -1
src/public/html/index.html
··· 14 14 </header> 15 15 <main> 16 16 <h1>Welcome to Apollo</h1> 17 - <form action="/channel" method="post" hx-boost="true"> 17 + <form action="/channels" method="post" hx-boost="true"> 18 18 <label for="channel-name">Channel name:</label> 19 19 <input id="channel-name" name="channel-name" type="text" placeholder="Channel name" required> 20 20 <p><small></small></p>