Skip to content

Commit 8c9f527

Browse files
committed
add dotenv and update readme
1 parent d85dd95 commit 8c9f527

File tree

7 files changed

+86
-93
lines changed

7 files changed

+86
-93
lines changed

.env_setup

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SECRET_KEY=Your Secret string value
2+
MONGO_URI=Your URI here

.gitignore

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,20 @@
11
node_modules
2-
.env
2+
.env
3+
4+
5+
# testing
6+
/coverage
7+
8+
# production
9+
/build
10+
11+
# misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

client/README.md

-68
This file was deleted.

client/src/components/profile/profile.jsx

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useEffect, useState } from 'react';
22
import jwt_decode from 'jwt-decode';
3+
import './profile.styles.scss';
34

45
function Profile() {
56
const [first_name, setfirst_name] = useState('');
@@ -17,32 +18,30 @@ function Profile() {
1718
}, []);
1819

1920
return (
20-
<div className="container">
21+
<div className="profile-container">
2122
<div className="">
22-
<div className="">
23-
{email ? (
24-
<h1 className="">PROFILE</h1>
25-
) : (
26-
<h2>Please Login/Register to view this page</h2>
27-
)}
28-
</div>
29-
<table className="">
30-
<tbody>
31-
<tr>
32-
<td>{first_name ? 'Fist Name' : null}</td>
33-
<td>{first_name}</td>
34-
</tr>
35-
<tr>
36-
<td>{last_name ? 'Last Name' : null}</td>
37-
<td>{last_name}</td>
38-
</tr>
39-
<tr>
40-
<td>{email ? 'Email' : null}</td>
41-
<td>{email}</td>
42-
</tr>
43-
</tbody>
44-
</table>
23+
{email ? (
24+
<h1 className="">PROFILE</h1>
25+
) : (
26+
<h2>Please Login/Register to view this page</h2>
27+
)}
4528
</div>
29+
<table className="">
30+
<tbody>
31+
<tr>
32+
<td>{first_name ? 'Fist Name:' : null}</td>
33+
<td>{first_name}</td>
34+
</tr>
35+
<tr>
36+
<td>{last_name ? 'Last Name:' : null}</td>
37+
<td>{last_name}</td>
38+
</tr>
39+
<tr>
40+
<td>{email ? 'Email:' : null}</td>
41+
<td>{email}</td>
42+
</tr>
43+
</tbody>
44+
</table>
4645
</div>
4746
);
4847
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.profile-container {
2+
justify-content: center;
3+
align-items: center;
4+
display: flex;
5+
flex-direction: column;
6+
}

readme.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# MERN-Authentication
2+
3+
BoilerPlate of MERN Stack user authentication using REACT as frontend and MONGODB as backend.
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5+
6+
## Dependencies
7+
8+
- bcrypt
9+
- cors
10+
- axios
11+
- express
12+
- mongoose
13+
- jwt
14+
15+
## Installation
16+
17+
For starting Frontend Client
18+
19+
```sh
20+
$ cd client/
21+
$ npm install
22+
$ npm start
23+
```
24+
25+
For starting Backend Server
26+
27+
```sh
28+
$ npm install
29+
$ npm run dev
30+
```

server.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require('dotenv').config();
2+
13
const express = require('express');
24
const cors = require('cors');
35
const bodyParser = require('body-parser');
@@ -10,8 +12,12 @@ app.use(bodyParser.json());
1012
app.use(cors());
1113
app.use(bodyParser.urlencoded({ extended: true }));
1214

15+
// Local DataBase
1316
const mongoURI = 'mongodb://localhost:27017/reactauthDB';
1417

18+
// MongoAtlas Datbase
19+
// const mongoURI = process.env.MONGO_URI;
20+
1521
mongoose
1622
.connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true })
1723
.then(() => console.log('MONGODB connected'))

0 commit comments

Comments
 (0)