Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CaCaoCritics
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bilel El Yaagoubi
CaCaoCritics
Merge requests
!8
Movie page
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Movie page
movie-page
into
master
Overview
0
Commits
14
Pipelines
14
Changes
3
Merged
Bilel El Yaagoubi
requested to merge
movie-page
into
master
3 years ago
Overview
0
Commits
14
Pipelines
14
Changes
3
0
0
Merge request reports
Viewing commit
381ca560
Prev
Next
Show latest version
3 files
+
114
−
1
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
381ca560
thx hamza
· 381ca560
Bilel El Yaagoubi
authored
3 years ago
backend/routes/genres.js
0 → 100644
+
66
−
0
View file @ 381ca560
Edit in single-file editor
Open in Web IDE
const
express
=
require
(
"
express
"
);
const
GenreModel
=
require
(
"
../models/genre
"
);
const
router
=
express
.
Router
();
module
.
exports
=
router
;
// router.get("/popular/:number", async function (req, res) {
// try {
// const filmNumber = await req.params["number"];
// const getGenres = await GenreModel.find({})
// .sort({ popularity: "desc" })
// .limit(filmNumber);
// res.send(getGenres);
// } catch (error) {
// console.log(error);
// }
// });
router
.
get
(
"
/genre/id/:id
"
,
async
function
(
req
,
res
)
{
try
{
const
genreId
=
await
req
.
params
[
"
id
"
];
const
getGenres
=
await
GenreModel
.
findOne
({
id
:
genreId
});
res
.
send
(
getGenres
.
name
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
});
// router.post("/new", async function (req, res) {
// try {
// const newGenre = new GenreModel({
// // Genre attributes
// publisher: req.body.publisher,
// title: req.body.title,
// date: req.body.date,
// imageURL: req.body.imageURL,
// viewers: req.body.viewers,
// });
// // Create a new genre instance
// const createdGenre = await newGenre.save();
// // What to do after genre has been saved !
// console.log("Genre Saved");
// res.send(createdGenre);
// } catch (error) {
// console.log(error);
// }
// });
// router.put("/id/:id", async function (req, res) {
// try {
// const genreId = await req.params["id"];
// await GenreModel.findByIdAndUpdate(genreId, {
// publisher: req.body.publisher,
// title: req.body.title,
// date: req.body.date,
// imageURL: req.body.imageURL,
// viewers: req.body.viewers,
// });
// res.send("Done");
// } catch (error) {
// console.log(error);
// res.send("Invalid Id");
// }
// });
Loading