Skip to content

Commit

Permalink
Merge pull request #1 from cpatel321/development
Browse files Browse the repository at this point in the history
recent changes merged with main branch
  • Loading branch information
cpatel321 authored Jul 20, 2024
2 parents 16fed44 + 4b0a980 commit bccf196
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 263 deletions.
Empty file removed Public/hiuaksghkasddg9uaFG.js
Empty file.
Binary file added Screenshots/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/login.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/recent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/register.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ const cors = require('cors');
const path = require('path');
const fs = require('fs');
const { get } = require('http');

const crypto = require('crypto');
const app = express();
const port = process.env.PORT || 3000;

app.use(bodyParser.json());
app.use(cors());
app.use(express.static(path.join(__dirname, 'public')));

function sha256(data) {
return crypto.createHash('sha256').update(data).digest('base64');
}
// Read word data history from the JSON file
let wordsData = [];
try {
Expand Down Expand Up @@ -138,7 +141,7 @@ app.post("/api/login",(req,res)=>{
// matchedUser={username:"admin",password:"admin"}
if (matchedUser) {
// console.log("matchedUser",matchedUser);
if (matchedUser.password === password) {
if (sha256(matchedUser.password) === password) {
// console.log("matchedUser",matchedUser)
token=Math.floor(Math.random() * 1000000000000000);
res.json({ success: true, token:token });
Expand Down Expand Up @@ -169,7 +172,7 @@ app.post("/api/register",(req,res)=>{
const newUser = {
userid: usersDict.length + 1,
username: username,
password: password
password: sha256(password)
};

usersDict.push(newUser);
Expand Down
8 changes: 0 additions & 8 deletions history/2.json

This file was deleted.

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

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start": "set NODE_ENV=production node index.js"
},
"keywords": [],
"author": "",
Expand All @@ -14,7 +15,6 @@
"cors": "^2.8.5",
"express": "^4.18.2",
"fs": "^0.0.1-security",
"mongodb": "^5.7.0",
"path": "^0.12.7"
}
}
46 changes: 43 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
Mywordbook is a dictionary cum notebook website targetted to user who usually tend to node some words in their diary to improve their vocabulary.
User can add words to their wordbook by simply searching the word along with any custom meaning they want to add.



**Mywordbook** is a dictionary cum notebook website targeted to users who usually tend to note some words in their diary to improve their vocabulary. Users can add words to their wordbook by simply searching for the word along with any custom meaning they want to add.

### Use the website [here](https://cpatel321.github.io/mywordbook/)
or
### Installation Process on local device

To install the Mywordbook Node application, follow these steps:

1. **Clone the Repository**:
```sh
git clone https://github.com/cpatel321/mywordbook.git
```

2. **Navigate to the Project Directory**:
```sh
cd mywordbook
```

3. **Install Dependencies**:
```sh
npm install
```

4. **Start the Application**:
```sh
node app.js
```

### Features
1. **Search Word**: Users can search for any word in the search bar and get the meaning of the word.
2. **Add Word**: Users can add words to their wordbook by simply searching for the word along with any custom meaning they want to add.
3. **Daily Word**: Users can see a new word every day on the home page.

### Screenshots
1. **Home Page**:
![Home Page](screenshots/home.png)
2. **Recent Words**:
![Recent Words](screenshots/recent.png)
3. **Login and Register**:
![Login and Register](screenshots/login.png)
![Login and Register](screenshots/register.png)
Empty file removed session.js
Empty file.
12 changes: 12 additions & 0 deletions sessions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,17 @@
{
"userid": 10,
"token": 501944017309751
},
{
"userid": 11,
"token": 913877090787963
},
{
"userid": 1,
"token": 551936347068207
},
{
"userid": 2,
"token": 147201072612235
}
]
Loading

0 comments on commit bccf196

Please sign in to comment.