Skip to content

Commit

Permalink
Added a Header component
Browse files Browse the repository at this point in the history
  • Loading branch information
Afsha10 committed Sep 26, 2023
1 parent cf043d0 commit 1786c14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from "react";
import youtubeLogo from "./components/images/youtubeLogo.png";
import MainContainer from "./components/MainContainer";
import Footer from "./components/Footer";
import Header from "./components/Header";
Expand Down
3 changes: 2 additions & 1 deletion client/src/components/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from "react";
import youtubeLogo from "./images/youtubeLogo.png";

function Header() {
return (
<header className="flex flex-row pb-8 pt-8 text-3xl sm:px-8 sm:pt-8 sm:text-4xl sm:font-bold sm:tracking-wider lg:text-6xl">
<img
src={youtubeLogo}
alt="Logo"
alt="YouTube Logo"
className="w-13 mx-4 h-9 sm:mx-7 sm:h-16 sm:w-24"
/>
<h1>YouTube Vault</h1>
Expand Down
13 changes: 10 additions & 3 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ const { Pool } = require("pg");
const bodyParser = require("body-parser");
const cors = require("cors");
require("dotenv").config();
const nocache = require("nocache");

const app = express();
const port = process.env.PORT || 5000;

app.use(cors());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(nocache());

app.use(express.json());

Expand Down Expand Up @@ -72,7 +70,16 @@ app.get("/videos/:id", function (req, res) {
// This endpoint is used to add a new video
app.post("/videos", (req, res) => {
const { title, url } = req.body;
if (!title || !url || !url.startsWith("https://www.youtube.com"|| urlObject.startsWith("https://youtu.be") || urlObject.startsWith("https://m.youtube.com") || urlObject.startsWith("https://youtube.com/"))) {
if (
!title ||
!url ||
!url.startsWith(
"https://www.youtube.com" ||
urlObject.startsWith("https://youtu.be") ||
urlObject.startsWith("https://m.youtube.com") ||
urlObject.startsWith("https://youtube.com/")
)
) {
res.status(400).json({
result: "failure",
message: "Video could not be saved",
Expand Down

0 comments on commit 1786c14

Please sign in to comment.