début tp 1b

This commit is contained in:
OMGiTzPomPom 2023-03-24 09:09:36 +01:00
parent 3d3dfe37f0
commit 81a7af99d8
4 changed files with 50 additions and 0 deletions

17
tp1b/.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
# npm
node_modules
package-lock.json
*.log
*.gz
# Coveralls
.nyc_output
coverage
# Benchmarking
benchmarks/graphs
.idea
# ignore additional files using core.excludesFile
# https://git-scm.com/docs/gitignore

22
tp1b/index.html Normal file
View File

@ -0,0 +1,22 @@
<html>
<h1>List of teams:</h1>
<div id="teams"></div>
<script>
const teamsDiv = document.getElementById('teams');
function fetchTeams() {
fetch('http://127.0.0.1:9090/equipes')
.then((response) => {
response.json()
.then((teams) => {
const mmoContent = teams.equipes.map((team) =>
`<div>${team.name} - ${team.id}</div>`
).join('');
teamsDiv.innerHTML = mmoContent;
})
}).catch(error => console.error);
}
fetchTeams();
</script>
</html>

11
tp1b/package.json Normal file
View File

@ -0,0 +1,11 @@
{
"scripts": {
"start": "node service.js"
},
"dependencies": {
"node-fetch": "^2.6.1",
"express": "4.17.1",
"body-parser": "1.19.0",
"request": "^2.88.0"
}
}

0
tp1b/service.js Normal file
View File