John is a member of the NestJS core team
Ever wanted to integrate your favorite library into NestJS? For example, while Nest has broad built-in su...
For further actions, you may consider blocking this person and/or reporting abuse
Great article. I'm using Typescript and it was giving me this error in the
getKnex()
function:did a bit of quick research and the fix is this:
Keep up the great work!
dev.to/umasankarswain/how-to-updat...
Another great article @johnbiundo 👏 This series is really interesting. Thanks for you work 👍
I have a few questions that might sound dumb but I'm going to ask them anyway:
Global
by default. Is that the way to go? Shouldn't we avoid global modules? Let's say I need a specific connection to a Postgres instance in module A and another connection to another instance in module B. If theNestKnexModule
is global, won't that be an issue?register
andregisterAsync
methods: I thought that global modules were supposed to exposeforRoot
(and its async variant) and that module-scoped modules were supposed to exposeregister
(and its async variant). Have I been wrong this whole time? Or is it just a matter of personal preference?Again, thanks for your work! I wish those schematics were released sooner as they would have saved me some time :)
Can't wait for your next post.
@fwoellfel, thanks! Glad it has been helpful!
Not dumb at all! I should probably discuss the use of
@Global()
in the article, so thanks for bringing it up. The main reason I use it is, to be honest, in a "utility" type module I find it convenient to register it once (usually in the root module), and then have it globally available. However you bring up an excellent point, and@Global()
definitely has some side effects (such as breaking module encapsulation) and is usually to be avoided. I want to give this some more thought, and I have an idea or two on how to handle your Module A/Module B question, but need to test a few things out. I'll report back!And your second question is good as well! To be honest, I hadn't quite sussed out that pattern of
register
vs.forRoot
, but now that you mention it, I'll have to go back and look more closely.Thanks so much for the thoughtful feedback. It really helps to have sharp eyes from people who have worked on dynamic modules. I hope to continue to improve these articles as a useful resource!
dev.to/umasankarswain/how-to-updat...
I am getting this error from the
/.constants
. Why is this throwing an error for a constant?Hi. For the future readers;
Error complains about NestKnexService can not resolve injected dependency. In this case the dependancy is NEST_KNEX_OPTIONS which is a custom provider. To make the dependency injection work, the provider needs to be registered in the knex module. NEST_KNEX_OPTIONS provider is not included in this article. It is included in github link author provided.
Hi Mike,
Can you provide some more context for this error? Do you have a repository that you can share?
Best,
John
hi, im new to nextjs and knex and im trying to build a custom api with both of these apps.
However, while following your guide, after running npm install im getting the following error
npm ERR! nest-knex@1.0.0 build:
tsc
npm ERR! Exit status 2
which are related to jest-diff module.
Can u maybe point me out any directions on how to fix this and finish the current integration of knex with nestjs?
ty
apparently this error seems to be a conflict between @types/jest and typescript versions, and can be solved by updating both with jest v26.0.4 and typescript above v3.8 (v3.9.6 currently).
sry for the bother
Good afternoon, I am using your package github.com/nestjsplus/knex
and I wanted to wrap the user.service in a repository and I got errors
Potential solutions:
Have you tried newer version of knex ^1.0.3 ?
There are some breaking changes for me line there is no exported interface "Config".
is it possible to get knex debug data into knexmodule?
Can you update this article? It seems out of date.
What is in constants.ts ?
And I get error 'knex_1.Knex is not a constructor'
Maybe a working git repo would be nice. Something is missing.
another awesome post from John :)
follow the tutorial and works in current date only fails in bellow fix
with
and one must update this dependencies
thanks John
Can't seem to get past "nest g -c @nestjsplus/dyn-schematics dynpkg nest-knex".
Having the same issue, did you manage to get the package to work?
I think I did, I will have to read through my code and find out. I'll get back to you
dev.to/umasankarswain/how-to-updat...