Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LOG2420
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olivier Gagnon
LOG2420
Commits
a0f5e243
Commit
a0f5e243
authored
4 years ago
by
Jimmy Bell
Browse files
Options
Downloads
Patches
Plain Diff
Ajout du serveur, du script readjson fonctionnel et fuck david
parent
318e83cb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
html/listeFrigos.html
+6
-1
6 additions, 1 deletion
html/listeFrigos.html
scripts/readJson.js
+6
-0
6 additions, 0 deletions
scripts/readJson.js
server.js
+23
-0
23 additions, 0 deletions
server.js
src/ressources/frigos.json
+2
-2
2 additions, 2 deletions
src/ressources/frigos.json
with
37 additions
and
3 deletions
html/listeFrigos.html
+
6
−
1
View file @
a0f5e243
...
...
@@ -22,7 +22,7 @@ body{
<meta
charset=
"UTF-8"
>
<title>
Liste des frigos
</title>
</head>
<body>
<body
id=
"listeFrigo"
>
<div
class=
"fridgeOutline"
>
<span
class=
"bold"
>
LIRE FRIGO
...
...
@@ -33,4 +33,9 @@ body{
</body>
<script
src=
"../scripts/readJson.js"
>
var
obj
=
httpGetJson
();
document
.
getElementById
(
"
listeFrigo
"
).
innerHTML
=
</script>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
scripts/readJson.js
0 → 100644
+
6
−
0
View file @
a0f5e243
function
httpGetJson
()
{
var
xmlHttpRequestLocal
=
new
XMLHttpRequest
();
xmlHttpRequestLocal
.
open
(
"
GET
"
,
"
http://127.0.0.1:3000/
"
,
false
);
xmlHttpRequestLocal
.
send
(
null
);
return
JSON
.
parse
(
xmlHttpRequestLocal
.
responseText
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
server.js
0 → 100644
+
23
−
0
View file @
a0f5e243
const
http
=
require
(
'
http
'
);
let
fs
=
require
(
'
fs
'
);
let
json
=
JSON
.
parse
(
fs
.
readFileSync
(
'
src/ressources/frigos.json
'
));
const
hostname
=
'
127.0.0.1
'
;
const
port
=
3000
;
const
server
=
http
.
createServer
((
req
,
res
)
=>
{
res
.
statusCode
=
200
;
res
.
setHeader
(
'
Content-Type
'
,
'
application/json
'
);
res
.
setHeader
(
"
Access-Control-Allow-Origin
"
,
"
*
"
);
if
(
req
.
method
===
'
GET
'
){
console
.
log
(
"
GET
"
)
res
.
end
(
JSON
.
stringify
(
json
))
}
res
.
statusCode
=
405
;
res
.
end
()
});
server
.
listen
(
port
,
hostname
,
()
=>
{
console
.
log
(
`Server running at http://
${
hostname
}
:
${
port
}
/`
);
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/ressources/frigos.json
+
2
−
2
View file @
a0f5e243
[
{
"array"
:
[
{
"nom"
:
"Frigo Antoine"
,
"addresse"
:
"754 Rue Antoine, Montréal, Québec H4R 3T1"
,
...
...
@@ -157,4 +157,4 @@
"repas"
:
[
]
}
]
]
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment