javascripte

Solutions on MaxInterview for javascripte by the best coders in the world

showing results for - "javascripte"
Maximilian
15 Mar 2019
1  coursesRouter.get('/:id',expressAsyncHandler(async(req,res)=>{
2    const pageSize = 1;
3    const page = Number(req.query.pageNumber) || 1;
4    const courseId = req.params.id;
5    const course =    await db('id').from('courses').where('id','=',courseId)
6    const courseName = course[0].name
7    const sections = await db('course_name').from('sections').where('course_name','=',courseName).limit(pageSize).offset(pageSize * (page - 1))
8    const count = await db('course_name').from('sections').count('sections')
9    console.log( Math.ceil( count[0]/pageSize));
10    res.send({sections , page, pages: Math.ceil( count[0]/pageSize)})
11})) 
Eisley
27 Apr 2017
1  coursesRouter.get('/:id',expressAsyncHandler(async(req,res)=>{
2    const pageSize = 1;
3    const page = Number(req.query.pageNumber) || 1;
4    const courseId = req.params.id;
5    const course =    await db('id').from('courses').where('id','=',courseId)
6    const courseName = course[0].name
7    const sections = await db('course_name').from('sections').where('course_name','=',courseName).limit(pageSize)
8    .offset(pageSize * (page - 1))
9    const count = await db('course_name').from('sections').count('sections')
10    console.log( Math.ceil( count[0]/pageSize));
11    res.send({sections , page, pages: Math.ceil( count[0]/pageSize)})
12})) 
queries leading to this page
java scriptjavascripte