File tree Expand file tree Collapse file tree 2 files changed +39
-3
lines changed Expand file tree Collapse file tree 2 files changed +39
-3
lines changed Original file line number Diff line number Diff line change 11const express = require ( 'express' )
2+
23const app = express ( )
3- const port = 3000
4+ const port = 3000 //Aqui define em qual porta vai rodar o app
5+
6+ const baseUrl = '/api/students'
47
5- app . get ( '/' , ( req , res ) => {
6- res . send ( 'Hello Worlde!' )
8+ //Rota para o get (read) dos alunos
9+ app . get ( `${ baseUrl } ` , ( req , res ) => {
10+ res . send ( 'Aqui é o get dos alunos' )
711} )
12+
13+ //Rota para o post (create) do alunos
14+ app . post ( `${ baseUrl } ` , ( req , res ) => {
15+ res . send ( 'Aqui é o post dos alunos' )
16+ } )
17+
18+ //Rota para o put (update) dos alunos
19+ app . put ( `${ baseUrl } /:id` , ( req , res ) => {
20+ res . send ( 'Aqui é o put dos alunos' )
21+ } )
22+
23+ //Rota para o delete dos alunos
24+ app . delete ( `${ baseUrl } /:id` , ( req , res ) => {
25+ res . send ( 'Aqui é o delete dos alunos' )
26+ } )
27+
28+ app . listen ( port ) ;
29+ //localhost:3000
Original file line number Diff line number Diff line change 1+ //Criado utilizando o REST Client
2+ GET http://localhost:3000/api/students
3+
4+ ###
5+
6+ POST http://localhost:3000/api/students
7+
8+ ###
9+
10+ PUT http://localhost:3000/api/students/1
11+
12+ ###
13+
14+ DELETE http://localhost:3000/api/students/1
You can’t perform that action at this time.
0 commit comments