Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/api/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ async function bootstrap() {

app.use(cookieParser());

app.setGlobalPrefix("api");

app.enableCors({
origin: [
"http://localhost:5173",
Expand All @@ -47,7 +49,7 @@ async function bootstrap() {
.setVersion("1.0")
.build();
const document = SwaggerModule.createDocument(app, config);
SwaggerModule.setup("api", app, document);
SwaggerModule.setup("api-docs", app, document);
exportSchemaToFile(document);

await app.listen(3000);
Expand Down
10 changes: 5 additions & 5 deletions apps/api/src/users/__tests__/user.controller.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ describe("UsersController (e2e)", () => {
await truncateTables(db, ["user"]);
});

describe("GET /users", () => {
describe("GET /api/users", () => {
it("should return all users", async () => {
const response = await request(app.getHttpServer())
.get("/users")
.get("/api/users")
.set("Cookie", cookies)
.expect(200);

Expand All @@ -71,10 +71,10 @@ describe("UsersController (e2e)", () => {
});
});

describe("GET /users/:id", () => {
describe("GET /api/users/:id", () => {
it("should return a user by id", async () => {
const response = await request(app.getHttpServer())
.get(`/users/${testUser.id}`)
.get(`/api/users/${testUser.id}`)
.set("Cookie", cookies)
.expect(200);

Expand All @@ -92,7 +92,7 @@ describe("UsersController (e2e)", () => {

it("should return 404 for non-existent user", async () => {
await request(app.getHttpServer())
.get(`/users/${crypto.randomUUID()}`)
.get(`/api/users/${crypto.randomUUID()}`)
.set("Cookie", cookies)
.expect(404);
});
Expand Down