début tp 1b
This commit is contained in:
parent
3d3dfe37f0
commit
81a7af99d8
17
tp1b/.gitignore
vendored
Normal file
17
tp1b/.gitignore
vendored
Normal 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
22
tp1b/index.html
Normal 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
11
tp1b/package.json
Normal 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
0
tp1b/service.js
Normal file
Loading…
x
Reference in New Issue
Block a user