Skip to content

Commit

Permalink
Alteraçao propriedade
Browse files Browse the repository at this point in the history
  • Loading branch information
Thasso Araújo committed May 18, 2020
1 parent 69ee0a9 commit 51a297e
Show file tree
Hide file tree
Showing 4 changed files with 1,403 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/controllers/UsuarioController.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
* @param {Response} response
*/
async store(request, response) {
const { nome, email, password } = request.body;
const { name, email, password } = request.body;

try {
let usuario = await Usuario.findOne({ email });
Expand All @@ -28,7 +28,7 @@ module.exports = {
}

usuario = await Usuario.create({
nome, email, password
name, email, password
});

return response.json(usuario);
Expand Down
2 changes: 1 addition & 1 deletion src/entities/Usuario.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const mongoose = require('mongoose');

const UsuarioSchema = new mongoose.Schema({
nome: String,
name: String,
email: String,
password: String
});
Expand Down
18 changes: 13 additions & 5 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,23 @@ mongoose.connect('mongodb+srv:https://teste:[email protected]/t
useUnifiedTopology: true,
});

/**
* Routes
*/
app.use(express.json());
app.use(routes);

/**
* Cors-Origin
*/
app.use(cors());
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "*");

app.use(cors());

return next();
});

/**
* Routes
*/
app.use(routes);

app.listen(3333);
Loading

0 comments on commit 51a297e

Please sign in to comment.