Created
November 14, 2018 00:37
-
-
Save iagocavalcante/328afadeec2082f50d1e28ff480a920a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') //importacao do pacote | |
const app = express() //instanciando express | |
const alunos = [ | |
{ | |
nome: 'Aluno1', | |
idade: 12 | |
}, | |
{ | |
nome: 'Aluno2', | |
idade: 13 | |
}, | |
{ | |
nome: 'Aluno3', | |
idade: 14 | |
}, | |
{ | |
nome: 'Aluno4', | |
idade: 15 | |
} | |
] | |
app.get('/api/v1/alunos', function (req, res) { //endereco da requisicao onde e retornado hello world | |
res.send(alunos) | |
}) | |
app.listen(3000) //execucao do servidor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment