wahyubucil / adonis-prisma Goto Github PK
View Code? Open in Web Editor NEWPrisma Provider for AdonisJS
License: MIT License
Prisma Provider for AdonisJS
License: MIT License
$ npm i @wahyubucil/adonis-prisma
returns:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @adonisjs/[email protected]
npm ERR! node_modules/@adonisjs/core
npm ERR! @adonisjs/core@"^6.2.1" from the root project
npm ERR! peer @adonisjs/core@"^6.2.0" from @adonisjs/[email protected]
npm ERR! node_modules/@adonisjs/auth
npm ERR! @adonisjs/auth@"^9.0.2" from the root project
npm ERR! 4 more (@adonisjs/lucid, @adonisjs/session, @adonisjs/redis, @japa/plugin-adonisjs)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @adonisjs/core@"^5.9.0" from @wahyubucil/[email protected]
npm ERR! node_modules/@wahyubucil/adonis-prisma
npm ERR! @wahyubucil/adonis-prisma@"*" from the root project
In the readme, we understand how to implement prisma with auth.
But for web api using token, what should be the config for the auth.ts
for the token provider ?
Thanks.
Route Login:
Route.post('/login', async ({ auth, request, response }) => {
const email = request.input('email')
const password = request.input('password')
await prisma.user.findUnique(
{ where: { email: String(email) } }
).then(async (user: User) => {
if (await Hash.verify(user.password, password)) {
const token = await auth.use('api').generate(user)
return token
}
})
message:
E_IOC_LOOKUP_FAILED: Cannot resolve \"Adonis/Lucid/Database\" namespace from the IoC Container"
stack:
IocLookupException: E_IOC_LOOKUP_FAILED: Cannot resolve \"Adonis/Lucid/Database\" namespace from the IoC Container\n at Function.lookupFailed (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/fold/build/src/Exceptions/IocLookupException.js:18:16)\n at Ioc.lookupOrFail (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/fold/build/src/Ioc/index.js:254:59)\n at Ioc.use (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/fold/build/src/Ioc/index.js:308:33)\n at AuthManager.makeTokenDatabaseProvider (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:79:53)\n at AuthManager.makeTokenProviderInstance (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:193:29)\n at AuthManager.makeOatGuard (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:104:36)\n at AuthManager.makeGuardInstance (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:212:29)\n at AuthManager.makeMapping (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/AuthManager/index.js:228:21)\n at Auth.use (/com.docker.devenvironments.code/backend/node_modules/@adonisjs/auth/build/src/Auth/index.js:37:58)\n at /com.docker.devenvironments.code/backend/start/routes.ts:37:34
Can you put node >=
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @wahyubucil/[email protected]
npm ERR! Found: @adonisjs/[email protected]
npm ERR! node_modules/@adonisjs/auth
npm ERR! @adonisjs/auth@"^3.0.7" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional @adonisjs/auth@"^8.2.3" from @wahyubucil/[email protected]
npm ERR! node_modules/@wahyubucil/adonis-prisma
npm ERR! @wahyubucil/adonis-prisma@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @adonisjs/[email protected]
npm ERR! node_modules/@adonisjs/auth
npm ERR! peerOptional @adonisjs/auth@"^8.2.3" from @wahyubucil/[email protected]
npm ERR! node_modules/@wahyubucil/adonis-prisma
npm ERR! @wahyubucil/adonis-prisma@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/alexisdumain/.npm/_logs/2023-08-11T23_16_59_124Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: /Users/alexisdumain/.npm/_logs/2023-08-11T23_16_59_124Z-debug-0.log```
This is the error I have after
adonis new pname
npm i --save-dev prisma && npm i @prisma/client
npm i @wahyubucil/adonis-prisma
Latest version of adonis
How Can I connect to multiple databases?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.