Quando informado na aula sobre o serviço, no arquivo de download não consta para ser baixado. Porem tentei gerar o arquivo da API faker mas não obtive sucesso no teste node clientes.js, já estando dentro da api.
const express = require('express') const bodyParser = require('body-parser')
const app = new express() const faker = require('faker')
app.use(bodyParser.json())
app.get('/:cpf', (req, res) => { const { cpf } = req.params
res.status(200).json({
cpf,
nome: faker.name.findName(),
dataDeNascimento: faker.date.past()
})
})
app.listen(8082, () => console.log('API rodando'))
Resposta:
PS C:\alura\node_api\servicos> node clientes.js internal/modules/cjs/loader.js:892 throw err; ^
Error: Cannot find module 'faker' Require stack:
- C:\alura\node_api\servicos\clientes.js at Function.Module.resolveFilename (internal/modules/cjs/loader.js:889:15) at Function.Module.load (internal/modules/cjs/loader.js:745:27) at Module.require (internal/modules/cjs/loader.js:961:19) at require (internal/modules/cjs/helpers.js:92:18) at Object. (C:\alura\node_api\servicos\clientes.js:5:15) at Module.compile (internal/modules/cjs/loader.js:1072:14) at Object.Module.extensions..js (internal/modules/cjs/loader.js:1101:10) at Module.load (internal/modules/cjs/loader.js:937:32) at Function.Module.load (internal/modules/cjs/loader.js:778:12) at Function.executeUserEntryPoint [as runMain] (internal/modules/runmain.js:76:12) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\alura\node_api\servicos\clientes.js' ] }