Skip to content

Commit f630b03

Browse files
committed
feat: add cache module and remove unused dashboard route from HTTP server
1 parent 0e67e33 commit f630b03

File tree

3 files changed

+1
-26
lines changed

3 files changed

+1
-26
lines changed

lib/src/cache.rs

Whitespace-only changes.

lib/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::env;
22
mod io_methods;
33
mod api_methods;
4+
mod cache;
45

56
#[tokio::main]
67
async fn main() {

src/server/createHttpServer.tsx

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,12 @@ import Fastify from 'fastify';
33
export async function createHttpServer() {
44
const fastify = Fastify({ logger: true });
55

6-
// Route to send a chat message and receive a response
76
fastify.post('/chat', async (request, reply) => {
87
const { message } = request.body as { message: string };
98
const responseMessage = `Received your message: ${message}`;
109
return { response: responseMessage };
1110
});
1211

13-
// Route to serve the dashboard page
14-
fastify.get('/dashboard', async (request, reply) => {
15-
const dashboardHtml = `
16-
<html>
17-
<head>
18-
<title>Dashboard</title>
19-
</head>
20-
<body>
21-
<h1>Application Logs</h1>
22-
<ul id="logs"></ul>
23-
<script>
24-
const eventSource = new EventSource('/logs');
25-
eventSource.onmessage = function(event) {
26-
const logList = document.getElementById('logs');
27-
const newLog = document.createElement('li');
28-
newLog.textContent = event.data;
29-
logList.appendChild(newLog);
30-
};
31-
</script>
32-
</body>
33-
</html>
34-
`;
35-
reply.type('text/html').send(dashboardHtml);
36-
});
37-
3812
try {
3913
await fastify.listen({ port: 3000, host: '0.0.0.0' });
4014
console.log('Server is running at http://localhost:3000');

0 commit comments

Comments
 (0)