-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/R.6.2.0-Api-Versioning-Prefix'
- Loading branch information
Showing
8 changed files
with
95 additions
and
21 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
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
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
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,19 @@ | ||
versioning_test: | ||
handler: ./src/functions/apis/versioning_test/handler | ||
endpoint: /version | ||
method: get | ||
enabled: true | ||
|
||
#ADD API VERSION | ||
#EXAMPLE OUTPUT: /login to /v1/login | ||
version: 1 | ||
|
||
#ADD API PREFIX | ||
#EXAMPLE: api | ||
#EXAMPLE OUTPUT: /login to /api/login | ||
#WORKS WITH VERSION SAMPLE OUTPUT: /api/v1/login | ||
prefix: api | ||
|
||
#ADD MIDDLEWARE | ||
#EXAMPLE: middleware: authorizer | ||
#middleware: <middleware_name> |
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,23 @@ | ||
import { API_RESPONSE } from '../../../../core'; | ||
import { HttpResponse, HttpRequest } from '../../../../core/libs/ApiEvent'; | ||
import { Response } from 'express'; | ||
import { Mysql } from '../../../../core/databases/Mysql'; | ||
import { Connection } from 'typeorm'; | ||
|
||
import { Response200 } from './response'; | ||
|
||
export async function execute(req: HttpRequest, res: Response): Promise<HttpResponse> { | ||
try { | ||
return API_RESPONSE( | ||
{ | ||
...Response200.SUCCESS, | ||
}, | ||
res, | ||
); | ||
} catch (e) { | ||
return API_RESPONSE(e, res); | ||
} | ||
// finally { | ||
// await Mysql.closeConnection(); | ||
// } | ||
} |
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,15 @@ | ||
import { HttpResponse } from '../../../../core/libs/ApiEvent'; | ||
|
||
/* | ||
Your Custom Response */ | ||
export class Response200 { | ||
static SUCCESS: HttpResponse = { | ||
code: 200, | ||
message: 'Success', | ||
}; | ||
} | ||
|
||
export class NotFound { | ||
code = 404; | ||
message = 'Username not found'; | ||
} |