From d52354f030793f3c3e1c982a92314fde703d22c5 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sun, 18 Jun 2023 02:02:08 -0400 Subject: ex4.1 fixing problem with secrets --- part4/blog/src/index.js | 47 --------------------------------------------- part4/blog/src/index.js.bak | 8 -------- 2 files changed, 55 deletions(-) delete mode 100644 part4/blog/src/index.js delete mode 100644 part4/blog/src/index.js.bak diff --git a/part4/blog/src/index.js b/part4/blog/src/index.js deleted file mode 100644 index f9dbf0d..0000000 --- a/part4/blog/src/index.js +++ /dev/null @@ -1,47 +0,0 @@ -const express = require('express') -const app = express() -const cors = require('cors') -const mongoose = require('mongoose') - -const blogSchema = new mongoose.Schema({ - title: String, - author: String, - url: String, - likes: Number -}) - -const Blog = mongoose.model('Blog', blogSchema) - -console.log("Connecting to mongo server") -const mongoUrl = 'mongodb+srv://imkusa:@cluster0.aookaoo.mongodb.net/?retryWrites=true&w=majority' -mongoose.connect(mongoUrl) -console.log("Successfully connected to mongo server") - -app.use(cors()) -app.use(express.json()) - -app.get('/api/blogs', (request, response) => { - Blog - .find({}) - .then(blogs => { - response.json(blogs) - }) - .catch((error) => { - console.log(error.message) - }) -}) - -app.post('/api/blogs', (request, response) => { - const blog = new Blog(request.body) - - blog - .save() - .then(result => { - response.status(201).json(result) - }) -}) - -const PORT = 3003 -app.listen(PORT, () => { - console.log(`Server running on port ${PORT}`) -}) diff --git a/part4/blog/src/index.js.bak b/part4/blog/src/index.js.bak deleted file mode 100644 index 8b1c250..0000000 --- a/part4/blog/src/index.js.bak +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import App from './App'; - -const root = ReactDOM.createRoot(document.getElementById('root')); -root.render( - -); -- cgit v1.2.3