-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tanmay Vaij <tanmayvaij22@gmail.com>
- Loading branch information
1 parent
0ab634c
commit 4df6126
Showing
6 changed files
with
146 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/handlers/signIn.handler.ts → src/handlers/auth/signIn.handler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export * from "./signIn.handler"; | ||
export * from "./signUp.handler"; | ||
export * from "./verifyUser.handler"; | ||
export * from "./auth/signIn.handler"; | ||
export * from "./auth/signUp.handler"; | ||
export * from "./auth/verifyUser.handler"; | ||
|
||
// admin routes | ||
export * from "./admin/listUsers.handler"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import swaggerJSDoc from "swagger-jsdoc"; | ||
import { serve, setup } from "swagger-ui-express"; | ||
import { Express } from "express"; | ||
|
||
const options: swaggerJSDoc.Options = { | ||
definition: { | ||
openapi: "3.1.0", | ||
|
||
tags: [ | ||
{ | ||
name: "Authentication", | ||
description: "Sample tag desc" | ||
} | ||
], | ||
|
||
info: { | ||
title: "UAuthX API Docs", | ||
version: "1.0.0", | ||
contact: { | ||
email: "tanmayvaij22@gmail.com", | ||
name: "Tanmay Vaij", | ||
url: "https://www.github.com/tanmayvaij", | ||
}, | ||
description: | ||
"This is an interactive api documentation for uauthx authentication micro-service", | ||
license: { | ||
name: "MIT", | ||
url: "", | ||
}, | ||
termsOfService: "", | ||
}, | ||
|
||
servers: [ | ||
{ | ||
url: "http://localhost:5000", | ||
description: "", | ||
}, | ||
], | ||
|
||
paths: { | ||
"/auth/sign-up": { | ||
post: { | ||
summary: "User sign up", | ||
tags: ["Authentication"], | ||
|
||
requestBody: { | ||
required: true, | ||
content: { | ||
"application/json": { | ||
schema: { | ||
type: "object", | ||
required: ["email", "password"], | ||
properties: { | ||
email: { | ||
type: "string", | ||
format: "email", | ||
example: "johndoe@example.com", | ||
}, | ||
password: { | ||
type: "string", | ||
format: "password", | ||
example: "Strong_Password@123", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
||
responses: { | ||
"200": { | ||
description: "", | ||
content: { | ||
"application/json": { | ||
schema: { | ||
type: "object", | ||
properties: { | ||
isSucess: { | ||
type: "boolean", | ||
example: "true", | ||
}, | ||
authToken: { | ||
type: "string", | ||
example: "<your-auth-token>", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
||
"409": { | ||
description: "", | ||
content: { | ||
"application/json": { | ||
schema: { | ||
type: "object", | ||
properties: { | ||
isSuccess: { | ||
type: "boolean", | ||
example: false, | ||
}, | ||
error: { | ||
type: "string", | ||
example: "Invalid username or password", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
||
"/auth/sign-in": { | ||
post: { | ||
tags: ["Authentication"], | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
||
apis: [], | ||
}; | ||
|
||
export const startSwagger = (app: Express) => { | ||
app.use("/api-docs", serve, setup(swaggerJSDoc(options))); | ||
}; | ||
|
||
|
||
interface P { | ||
"200": { | ||
|
||
} | ||
} |