-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove compression and helmet for user
- Loading branch information
1 parent
170fb92
commit 7f26f65
Showing
15 changed files
with
76 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
import { KompactApp } from 'kompact' | ||
import { MainController, BookController } from './controllers' | ||
import { KompactApp } from 'kompact'; | ||
import { MainController, BookController } from './controllers'; | ||
|
||
|
||
const PORT = 3002 | ||
const PORT = 3002; | ||
|
||
async function main() { | ||
const app = new KompactApp({ | ||
controllers: [MainController, BookController], | ||
}) | ||
|
||
}); | ||
|
||
/* | ||
// will be custom these param, don't hard code anymore | ||
this.app.use(helmet()); // help secure Express apps by setting HTTP response headers. | ||
this.app.use(compression()); | ||
*/ | ||
|
||
app.start(PORT, () => { | ||
console.log(`running at ${PORT}`) | ||
}) | ||
console.log(`running at ${PORT}`); | ||
}); | ||
} | ||
|
||
main() | ||
main(); |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
28 changes: 14 additions & 14 deletions
28
...ages/kompact-core/src/error/http-error.ts → packages/kompact-core/src/core/http-error.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
import { ReasonStatusCode, StatusCode } from './constant' | ||
import { ReasonStatusCode, StatusCode } from '../constant'; | ||
|
||
export class HttpError extends Error { | ||
public status: number | ||
public status: number; | ||
// will be change number to an enum or object later | ||
constructor(message: string, status: number) { | ||
super(message) | ||
this.status = status | ||
super(message); | ||
this.status = status; | ||
} | ||
} | ||
|
||
export class ConflictRequestError extends HttpError { | ||
constructor( | ||
message = ReasonStatusCode[StatusCode.CONFLICT], | ||
statusCode = StatusCode.CONFLICT, | ||
statusCode = StatusCode.CONFLICT | ||
) { | ||
super(message, statusCode) | ||
super(message, statusCode); | ||
} | ||
} | ||
|
||
export class BadRequestError extends HttpError { | ||
constructor( | ||
message = ReasonStatusCode[StatusCode.BAD_REQUEST], | ||
statusCode = StatusCode.BAD_REQUEST, | ||
statusCode = StatusCode.BAD_REQUEST | ||
) { | ||
super(message, statusCode) | ||
super(message, statusCode); | ||
} | ||
} | ||
|
||
export class AuthFailureError extends HttpError { | ||
constructor( | ||
message = ReasonStatusCode[StatusCode.UNAUTHORIZED], | ||
statusCode = StatusCode.UNAUTHORIZED, | ||
statusCode = StatusCode.UNAUTHORIZED | ||
) { | ||
super(message, statusCode) | ||
super(message, statusCode); | ||
} | ||
} | ||
|
||
export class NotFoundError extends HttpError { | ||
constructor( | ||
message = ReasonStatusCode[StatusCode.NOT_FOUND], | ||
statusCode = StatusCode.NOT_FOUND, | ||
statusCode = StatusCode.NOT_FOUND | ||
) { | ||
super(message, statusCode) | ||
super(message, statusCode); | ||
} | ||
} | ||
|
||
export class ForbiddenError extends HttpError { | ||
constructor( | ||
message = ReasonStatusCode[StatusCode.FORBIDDEN], | ||
statusCode = StatusCode.FORBIDDEN, | ||
statusCode = StatusCode.FORBIDDEN | ||
) { | ||
super(message, statusCode) | ||
super(message, statusCode); | ||
} | ||
} |
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 +1,2 @@ | ||
export * from './response' | ||
export * from './response'; | ||
export * from './http-error'; |
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 was deleted.
Oops, something went wrong.
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,6 @@ | ||
declare namespace Express { | ||
export interface Request { | ||
requestId?: string | string[]; | ||
user?: object; | ||
} | ||
} |
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,9 +1,6 @@ | ||
import 'reflect-metadata' | ||
export * from './decorator' | ||
export * from './app' | ||
export * from './interface' | ||
// export * from './database' | ||
export * from './auth' | ||
export * from './error' | ||
export * from './utils' | ||
export * from './core' | ||
import 'reflect-metadata'; | ||
export * from './decorator'; | ||
export * from './kompact-application'; | ||
export * from './interface'; | ||
export * from './utils'; | ||
export * from './core'; |
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 |
---|---|---|
|
@@ -3591,7 +3591,7 @@ compressible@~2.0.16: | |
dependencies: | ||
mime-db ">= 1.43.0 < 2" | ||
|
||
[email protected], compression@^1.7.4: | ||
[email protected]: | ||
version "1.7.4" | ||
resolved "https://registry.yarnpkg.com/compression/-/compression-1.7.4.tgz#95523eff170ca57c29a0ca41e6fe131f41e5bb8f" | ||
integrity sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ== | ||
|
@@ -4955,11 +4955,6 @@ hasown@^2.0.0, hasown@^2.0.2: | |
dependencies: | ||
function-bind "^1.1.2" | ||
|
||
helmet@^7.1.0: | ||
version "7.1.0" | ||
resolved "https://registry.yarnpkg.com/helmet/-/helmet-7.1.0.tgz#287279e00f8a3763d5dccbaf1e5ee39b8c3784ca" | ||
integrity sha512-g+HZqgfbpXdCkme/Cd/mZkV0aV3BZZZSugecH03kl38m/Kmdx8jKjBikpDj2cr+Iynv4KpYEviojNdTJActJAg== | ||
|
||
hosted-git-info@^7.0.0: | ||
version "7.0.2" | ||
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-7.0.2.tgz#9b751acac097757667f30114607ef7b661ff4f17" | ||
|