From 0670b4b65d050c65e1173d8254f0969838090b34 Mon Sep 17 00:00:00 2001 From: X4Lo Date: Sun, 31 Mar 2024 04:01:36 +0000 Subject: [PATCH] added routes --- backend/routes/entry.js | 21 +++++++++++++++++++++ backend/routes/routes.js | 8 ++++++++ 2 files changed, 29 insertions(+) create mode 100644 backend/routes/entry.js create mode 100644 backend/routes/routes.js diff --git a/backend/routes/entry.js b/backend/routes/entry.js new file mode 100644 index 0000000..10899bb --- /dev/null +++ b/backend/routes/entry.js @@ -0,0 +1,21 @@ +// routes/tasks.js +const express = require('express'); +const { fetchMovieData } = require('../services/tmdbService'); +const router = express.Router(); + +// GET all entries +router.get('/', (req, res) => { + res.status(200).json(tasks); +}); + +// POST a new entry +router.post('/', async (req, res) => { + const { tmdb_id } = req.body; + const entry = await fetchMovieData(tmdb_id); + + console.log(entry); + + res.status(201).json(entry); +}); + +module.exports = router; diff --git a/backend/routes/routes.js b/backend/routes/routes.js new file mode 100644 index 0000000..981cd94 --- /dev/null +++ b/backend/routes/routes.js @@ -0,0 +1,8 @@ +const express = require('express'); +const entryRoutes = require('./entry'); + +const router = express.Router(); + +router.use('/entries', entryRoutes); + +module.exports = router; \ No newline at end of file