-
Notifications
You must be signed in to change notification settings - Fork 530
Tooling and code cleanup #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
20a0085 to
0372d16
Compare
src/_boot/server.ts
Outdated
| 'accept, accept-encoding, origin, referer, sec-fetch-*, user-agent, content-type, authorization', | ||
| credentials: true, | ||
| origin: typeof http.cors === 'boolean' ? req.get('origin') : http.cors?.allowedOrigins, | ||
| methods: '*', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should add this (and the allowed headers) to the configs as well?
docker-compose.yml
Outdated
| MONGO_INITDB_ROOT_PASSWORD: blog | ||
|
|
||
| mongo-express: | ||
| container_name: nab-mongo-express |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of nab (for this reason https://www.oxfordlearnersdictionaries.com/definition/american_english/nab), what do you think about pretending the container names with app, blog or something like that?
src/_lib/errors/BadRequestError.ts
Outdated
| const type = Symbol(); | ||
| const code = 'BadRequestError'; | ||
| const name = 'BadRequestError'; | ||
| const _message = 'Bad Request'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about calling it defaultMessage?
src/_lib/errors/BaseError.ts
Outdated
| meta?: M; | ||
| }>; | ||
|
|
||
| type Props<M = any> = Omit<Exception<M>, 'name'> & { name?: string }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about introducing this type to the _lib and using it here?
type PartializeProperties<Type, Properties extends keyof Type> = Omit<Type, Properties> &
Partial<Pick<Type, Properties>>;This way we don't need to change two parts of the same line in case we make another property optional.
src/_lib/repl/index.ts
Outdated
| return repl; | ||
| }; | ||
|
|
||
| let destroySocket: (...args: any) => void = () => null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we able to use the socket type itself here?
| let destroySocket: (...args: any) => void = () => null; | |
| let destroySocket: Socket['destroy'] = () => null; |
| throw BusinessError.create( | ||
| useBundle('article.error.alreadyPublished', { id: payload, publishedAt: article.publishedAt }) | ||
| // eslint-disable-next-line max-len | ||
| `Can't republish the Article(id=${payload}) because it was already published on ${article.publishedAt.toISOString()}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `Can't republish the Article(id=${payload}) because it was already published on ${article.publishedAt.toISOString()}` | |
| `Can't republish the Article(id=${payload}) because it was already published at ${article.publishedAt.toISOString()}` |
4240de5 to
1809a50
Compare
No description provided.