Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Projet tutoré S5
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
DUCRUET THIBAULT p2306959
Projet tutoré S5
Commits
cc9edb8b
Commit
cc9edb8b
authored
1 year ago
by
Bastien
Browse files
Options
Downloads
Patches
Plain Diff
recuperer infos film
parent
7d35f7ee
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
backend/src/controllers/movieController.js
+16
-0
16 additions, 0 deletions
backend/src/controllers/movieController.js
backend/src/routes/movies.js
+8
-0
8 additions, 0 deletions
backend/src/routes/movies.js
backend/src/server.js
+2
-0
2 additions, 0 deletions
backend/src/server.js
with
26 additions
and
0 deletions
backend/src/controllers/movieController.js
0 → 100644
+
16
−
0
View file @
cc9edb8b
const
db
=
require
(
'
../models/db
'
);
exports
.
getMovieInformations
=
(
req
,
res
,
next
)
=>
{
let
filmId
=
req
.
params
.
id
;
db
.
query
(
'
SELECT * FROM Film WHERE tconst = ?
'
,
[
filmId
],
function
(
error
,
results
,
fields
)
{
if
(
error
)
{
res
.
status
(
500
).
json
({
error
});
}
else
{
let
infos
=
results
[
0
];
res
.
status
(
200
).
json
(
infos
);
}
})
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/src/routes/movies.js
0 → 100644
+
8
−
0
View file @
cc9edb8b
const
express
=
require
(
'
express
'
);
const
router
=
express
.
Router
();
const
controller
=
require
(
'
../controllers/movieController
'
);
router
.
get
(
'
/:id
'
,
controller
.
getMovieInformations
);
module
.
exports
=
router
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/src/server.js
+
2
−
0
View file @
cc9edb8b
...
@@ -16,6 +16,8 @@ app.use(express.urlencoded({ extended: true }));
...
@@ -16,6 +16,8 @@ app.use(express.urlencoded({ extended: true }));
app
.
use
(
cors
({
origin
:
'
http://localhost:5173
'
,
credentials
:
true
}));
app
.
use
(
cors
({
origin
:
'
http://localhost:5173
'
,
credentials
:
true
}));
const
userRoutes
=
require
(
'
./routes/user
'
);
const
userRoutes
=
require
(
'
./routes/user
'
);
app
.
use
(
'
/user
'
,
userRoutes
);
app
.
use
(
'
/user
'
,
userRoutes
);
const
moviesRoutes
=
require
(
'
./routes/movies
'
);
app
.
use
(
'
/movies
'
,
moviesRoutes
);
app
.
listen
(
port
,
()
=>
{
app
.
listen
(
port
,
()
=>
{
console
.
log
(
`Serveur en cours d'exécution sur le port
${
port
}
`
);
console
.
log
(
`Serveur en cours d'exécution sur le port
${
port
}
`
);
...
...
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