Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict'
- const Students = use('App/Models/Student')
- class StudentAPIController {
- async index({ response }) {
- let student = await Students.all();
- return response.json(student);
- }
- async show({ params, response }) {
- const student_detail = await Students.find(params.student_id)
- if (!student_detail) {
- return response.json({
- code: '404',
- message: 'User not found'
- })
- }
- return response.json({
- 'data': student_detail
- })
- }
- }
- module.exports = StudentAPIController
Advertisement
Add Comment
Please, Sign In to add comment