Skip to content

Commit d1b5a7b

Browse files
coderabbit changes
1 parent 99cb613 commit d1b5a7b

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/node_modules
2-
src/generated/prisma
2+
src/generated/prisma/
33
.env

deployment-platforms/railway/src/index.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import "dotenv/config";
2-
import { Hono } from "hono";
3-
import { PrismaClient } from "./generated/prisma/client";
4-
import { serve } from "@hono/node-server";
1+
import 'dotenv/config'
2+
import { Hono } from 'hono'
3+
import { PrismaClient } from './generated/prisma/client'
4+
import { serve } from '@hono/node-server'
55

6-
const prisma = new PrismaClient();
7-
const app = new Hono();
6+
const prisma = new PrismaClient()
7+
const app = new Hono()
88

9-
app.get("/", (c) => {
9+
app.get('/', (c) => {
1010
const html = `
1111
<!DOCTYPE html>
1212
<html>
@@ -56,71 +56,71 @@ app.get("/", (c) => {
5656
</script>
5757
</body>
5858
</html>
59-
`;
60-
return c.html(html);
61-
});
59+
`
60+
return c.html(html)
61+
})
6262

63-
app.get("/api", async (c) => {
64-
return c.json({ up: true });
65-
});
63+
app.get('/api', async (c) => {
64+
return c.json({ up: true })
65+
})
6666

67-
app.get("/api/seed", async (c) => {
67+
app.get('/api/seed', async (c) => {
6868
try {
69-
await prisma.post.deleteMany({});
70-
await prisma.user.deleteMany({});
69+
await prisma.post.deleteMany({})
70+
await prisma.user.deleteMany({})
7171

7272
const author1 = await prisma.user.create({
7373
data: {
74-
75-
name: "Jane Doe",
74+
75+
name: 'Jane Doe',
7676
posts: {
7777
create: {
78-
title: "Comparing Database Types",
78+
title: 'Comparing Database Types',
7979
content:
80-
"https://www.prisma.io/blog/comparison-of-database-models-1iz9u29nwn37/",
80+
'https://www.prisma.io/blog/comparison-of-database-models-1iz9u29nwn37/',
8181
published: true,
8282
},
8383
},
8484
},
8585
include: { posts: true },
86-
});
86+
})
8787

8888
const author2 = await prisma.user.create({
8989
data: {
90-
91-
name: "John Smith",
90+
91+
name: 'John Smith',
9292
posts: {
9393
create: {
94-
title: "Getting Started with Prisma",
95-
content: "https://www.prisma.io/docs/getting-started",
94+
title: 'Getting Started with Prisma',
95+
content: 'https://www.prisma.io/docs/getting-started',
9696
published: true,
9797
},
9898
},
9999
},
100100
include: { posts: true },
101-
});
101+
})
102102

103103
return c.json({
104-
message: "Database seeded successfully",
104+
message: 'Database seeded successfully',
105105
authors: [author1, author2],
106-
});
106+
})
107107
} catch (e) {
108-
return c.json({ error: "Failed to seed database" }, 500);
108+
return c.json({ error: 'Failed to seed database' }, 500)
109109
}
110-
});
110+
})
111111

112-
app.get("/api/feed", async (c) => {
112+
app.get('/api/feed', async (c) => {
113113
const posts = await prisma.post.findMany({
114114
where: { published: true },
115115
include: { author: true },
116-
});
117-
return c.json(posts);
118-
});
116+
})
117+
return c.json(posts)
118+
})
119119

120-
const port = process.env.PORT ? Number(process.env.PORT) : 3000;
121-
console.log(`Server is running on port http://localhost:${port}`);
120+
const port = process.env.PORT ? Number(process.env.PORT) : 3000
121+
console.log(`Server is running at http://localhost:${port}`)
122122

123123
serve({
124124
fetch: app.fetch,
125125
port,
126-
});
126+
})

0 commit comments

Comments
 (0)