Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict'
- const got = use ('got')
- const edge = use('edge.js')
- /** @typedef {import('@adonisjs/framework/src/Request')} Request */
- /** @typedef {import('@adonisjs/framework/src/Response')} Response */
- /** @typedef {import('@adonisjs/framework/src/View')} View */
- /**
- * Resourceful controller for interacting with students
- */
- class StudentController {
- /**
- * Show a list of all students.
- * GET students
- *
- * @param {object} ctx
- * @param {Request} ctx.request
- * @param {Response} ctx.response
- * @param {View} ctx.view
- */
- async index ({ request, response, view }) {
- const student_api_val = await got('http://127.0.0.1:3333/api/student/show/1')
- return view.render('student.index', { adonisuser: student_api_val.body.toJSON()})
- // console.log(student_api_val.body)
- }
- /**
- * Render a form to be used for creating a new student.
- * GET students/create
- *
- * @param {object} ctx
- * @param {Request} ctx.request
- * @param {Response} ctx.response
- * @param {View} ctx.view
- */
- async create ({ request, response, view }) {
- }
- /**
- * Create/save a new student.
- * POST students
- *
- * @param {object} ctx
- * @param {Request} ctx.request
- * @param {Response} ctx.response
- */
- async store ({ request, response }) {
- }
- /**
- * Display a single student.
- * GET students/:id
- *
- * @param {object} ctx
- * @param {Request} ctx.request
- * @param {Response} ctx.response
- * @param {View} ctx.view
- */
- async show ({ params, request, response, view }) {
- }
- /**
- * Render a form to update an existing student.
- * GET students/:id/edit
- *
- * @param {object} ctx
- * @param {Request} ctx.request
- * @param {Response} ctx.response
- * @param {View} ctx.view
- */
- async edit ({ params, request, response, view }) {
- }
- /**
- * Update student details.
- * PUT or PATCH students/:id
- *
- * @param {object} ctx
- * @param {Request} ctx.request
- * @param {Response} ctx.response
- */
- async update ({ params, request, response }) {
- }
- /**
- * Delete a student with id.
- * DELETE students/:id
- *
- * @param {object} ctx
- * @param {Request} ctx.request
- * @param {Response} ctx.response
- */
- async destroy ({ params, request, response }) {
- }
- }
- module.exports = StudentController
Advertisement
Add Comment
Please, Sign In to add comment