Skip to content

Commit 91ab2d4

Browse files
committedNov 3, 2022
primer commit
0 parents  commit 91ab2d4

File tree

1,158 files changed

+149045
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,158 files changed

+149045
-0
lines changed
 

‎front-client/index.html

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html lang="es">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Client - Front</title>
8+
</head>
9+
<body>
10+
<h1>Esto es un html plano</h1>
11+
12+
<form action="/">
13+
<div class = "form-group">
14+
<label for="id">ID:</label>
15+
<input type="text" class="form-control" name="id" id="id" disabled>
16+
</div>
17+
<br>
18+
<div class = "form-group">
19+
<label for="nickname">Nickname:</label>
20+
<input type="text" class="form-control" name="nickname" id="nickname" placeholder="Ingresa tu nickname o nombre">
21+
</div>
22+
<br>
23+
<div class="form-group">
24+
<label for="avatar">Avatar:</label>
25+
<input type="file" class="form-control" name="avatar" id="avatar" placeholder="Sube tu avatar o foto">
26+
</div>
27+
<br>
28+
<button type="submit" class="btn btn-success">Enviar</button>
29+
</form>
30+
<script src="./js/app.js"></script>
31+
32+
</body>
33+
</html>

‎front-client/js/app.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const form =document.querySelector("form");
2+
3+
form.addEventListener("submit", e => {
4+
e.preventDefault();
5+
const nicknameValue = e.currentTarget.nickname.value;
6+
const avatarFile = e.currentTarget.avatar.files[0];
7+
let postData = new FormData();
8+
postData.append("nickname", nicknameValue)
9+
postData.append("avatar", avatarFile)
10+
11+
fetch("http://localhost:3000/guardarComoApi", {
12+
mode: 'no-cors',
13+
method: "POST",
14+
body: postData
15+
})
16+
.then(response => response.json)
17+
.then(data => {
18+
console.log(nicknameValue, avatarFile.name)
19+
})
20+
})

0 commit comments

Comments
 (0)