Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./node_modules
1 change: 1 addition & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
../node_modules
15,912 changes: 15,912 additions & 0 deletions client/package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"web-vitals": "^0.2.4"
},
Expand Down
55 changes: 47 additions & 8 deletions client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,54 @@
import logo from './logo.svg';
import './App.css';
import Error_ from './components/error/Error';
import history from './history';
import {
Route,
Router,
Switch,
BrowserRouter as Routerr,
} from 'react-router-dom';
import { useState, useEffect } from 'react';

import Home from './components/home/Home';
import screenGif from './gif/splash-screen.gif';

function App() {
return (
<div className="App">
<header className="App-header">
<h1>Hello, All-Notes :)</h1>

</header>
</div>
);
const [onLoading, changeLoading] = useState(true);
let content = <img src={screenGif} alt='Loading...' />;

// let content = 'Loading...';

if (!onLoading)
content = (
<div className='App'>
<Router history={history}>
<Switch>
<Route path='/' exact component={Home} />
<Route path='/:error' exact component={Error_} />
</Switch>
</Router>
</div>
);

useEffect(() => {
changeLoading(false);
}, []);

// let contentToShow = (
// <div className='App'>
// <Router history={history}>
// <Switch>
// <Route path='/' exact component={Home} />
// <Route path='/:error' exact component={Error_} />
// </Switch>
// </Router>
// </div>
// );

return content;

// {onLoading ? { contentToShow } : <div>" loading" </div>}
}

export default App;
21 changes: 21 additions & 0 deletions client/src/components/error/Error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import error_image from './error-screen-desktop.png';
import { Link, Router } from 'react-router-dom';
import history from '../../history';

function Error() {
return (
<div>
<h2> Error 404 !</h2>
<Router history={history}>
<Link to='/'>
<div className='App-header'>
<img src={error_image} alt='Error 404' />
</div>
</Link>
</Router>
</div>
);
}

export default Error;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions client/src/components/home/Home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

function Home() {
return (
<div>
<header className='App-header'>
<h1>Hello, All-Notes </h1>
</header>
</div>
);
}

export default Home;
Binary file added client/src/gif/splash-screen.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions client/src/history.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const createHistory = require('history').createBrowserHistory;

export default createHistory();
1 change: 0 additions & 1 deletion design/Logo-design

This file was deleted.

146 changes: 146 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions server/Routes/Delete/Delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const express = require('express');
const app = express();

// assuming model to be of name - User
const User = mongoose.model('User');

module.exports.DeleteRoute = (req, res) => {
const { body } = req;
const { name, email, _id } = body;

if (!name || !email || !_id)
return res.send({
message: ' Error ! Product not found ',
});

User.findByIdAndRemove(_id, (err, docs) => {
if (err) {
return res.send({
message: ' Sorry ! The process could not be completed',
});
} else
return res.send({
message: ' User sucessfully deleted !',
});
});
};
29 changes: 17 additions & 12 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
const express = require('express')
const express = require('express');
const app = express();
const port = 8000;
const router = express.Router();

// Delete Route
import Delete from './Routes/Delete/Delete';

var project = [
{
"name":"All Notes"
}
]

{
name: 'All Notes',
},
];

router.delete('/delete/user', Delete.DeleteRoute);

app.get('/', (req, res) => {
res.json(project)
});
app.listen(port, () => {
console.log(`Application listening on port ${port}!`)
});
res.json(project);
});

app.listen(port, () => {
console.log(`Application listening on port ${port}!`);
});