We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hey, im loving lambda-api so far. Quick question, is there a way to add a context to handlers ? Let's say
app.get("/posts", getPosts); async function getPosts(req,res,context){ const prisma = context.prisma; return prisma.posts.findMany({}); }
And this is basically for code splitting
The text was updated successfully, but these errors were encountered:
You can use req.context to retrieve the context object.
req.context
Sorry, something went wrong.
Hi @tcarac you can do this assigning the service you want directly to app during initialization.
example: const api = require('lambda-api')() api.services = {prisma} api.post('/', async (req, res) => { const prisma = api.services.prisma; return prisma.posts.findMany({});}
const api = require('lambda-api')()
api.services = {prisma}
api.post('/', async (req, res) => { const prisma = api.services.prisma; return prisma.posts.findMany({});}
No branches or pull requests
Hey, im loving lambda-api so far.
Quick question, is there a way to add a context to handlers ?
Let's say
And this is basically for code splitting
The text was updated successfully, but these errors were encountered: