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
By following example on kakapo.js and others to use findOne method, it seems that it doesn't work as well as expected.
findOne
It return an empty object instead of my selected data. To fix that, i have to replace
db.findOne('users', userId );
with
db.findOne('users', user => user.id === +userId );
export default (router, database) => { database.register('users', () => ({ name: 'Henry', phone: 1234567890, })); database.create('users', 5); router.get('/users/:userId', (req, db) => { const userId = req.params.userId; return db.findOne('users', user => user.id === +userId ); }); };
import { Database, Router, Server } from 'kakapo'; import mockUsers from './users'; const db = new Database(); const router = new Router(); const server = new Server(); mockUsers(router, db); server.use(db); server.use(router);
fetch('/users/2', user => { console.log(user); });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Issue
By following example on kakapo.js and others to use
findOne
method, it seems that it doesn't work as well as expected.It return an empty object instead of my selected data. To fix that, i have to replace
with
Complete example
The text was updated successfully, but these errors were encountered: