Skip to content

Commit

Permalink
Merge pull request #12 from jonfairbanks/develop
Browse files Browse the repository at this point in the history
Develop --> Master
  • Loading branch information
jonfairbanks authored Jun 18, 2019
2 parents 43b255f + 416d56f commit c7348e5
Show file tree
Hide file tree
Showing 21 changed files with 643 additions and 2,326 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ server/config/config.js
server/config/redis.js
.vscode/settings.json
client/src/config/config.js
server/.env
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ Yo Dawg, heard you're tired of remembering URLs

- ### Server

- [Express](https://expressjs.com/)- Node.js Framework for Building REST APIs
- [MongoDB](http://mongodb.com/)- Document Oriented NoSQL Database
- [Mongoose](https://http://mongoosejs.com)- MongoDB Object Modeling
- [Valid-url](https://github.com/ogt/valid-url)- URL Validation Functions
- [Nginx](https://www.nginx.com)- Reverse Proxy
- [Express](https://expressjs.com/) - Node.js Framework for Building REST APIs
- [MongoDB](http://mongodb.com/) - Document Oriented NoSQL Database
- [Mongoose](https://http://mongoosejs.com) - MongoDB Object Modeling
- [Valid-url](https://github.com/ogt/valid-url) - URL Validation Functions
- [Nginx](https://www.nginx.com) - Reverse Proxy

- ### Client

- [React](https://reactjs.org/) - JS Library for Building UI's
- [React-router](https://github.com/ReactTraining/react-router)- Complete Routing Library for React
- [Materialize css](http://materializecss.com/)- Responsive Front-end Framework Based on Material UI
- [React-router](https://github.com/ReactTraining/react-router) - Complete Routing Library for React
- [Materialize css](http://materializecss.com/) - Responsive Front-end Framework Based on Material UI
- [Auth0 Lock](https://www.npmjs.com/package/auth0-lock) - Universal login and access control

## Getting Started

Expand Down Expand Up @@ -117,15 +118,28 @@ location / {
}
```

## Enabling API Authentication
By default, the Yo backend API is open which would allow anyone who knew your API endpoint to list, edit or even delete links if they chose. To prevent this, you can enable Auth0 authentication for requests between the client and server.

- Sign up for an Auth0 account @ https://auth0.com
- Create and Setup a Regular Web Application. Configure it as you see fit.
- In the Yo config.js files, set the Client and/or Domain provided by Auth0.
- Before leaving Auth0, create a user account for your application under User & Roles.
- When starting the Yo client, pass `REACT_APP_AUTH=true` as an ENV variable to enforce user logins.
- When starting the Yo server, pass `AUTH=true` as an ENV variable to enable authentication checks.
- Navigate to Yo and login with the previously created user. If successful, you should be logged into the dashboard successfully.

## ☑ TODO

- [x] Auto Update Tab Data
- [x] Client Dockerfile
- [x] Server Dockerfile
- [x] API Authentication
- [ ] Better Error Handling when Navigating to Unset Names
- [ ] Pass through for Query Parameters
- [ ] Swipeable Tabs
- [ ] Edit/Delete Functionality
- [ ] Further refactor Home.js

## Contributers
Jon Fairbanks - Maintainer
13 changes: 0 additions & 13 deletions client/package-lock.json

This file was deleted.

11 changes: 6 additions & 5 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@
"eject": "react-scripts eject"
},
"dependencies": {
"axios": "^0.18.0",
"auth0-lock": "^11.16.3",
"axios": "^0.19.0",
"bad-words": "^3.0.2",
"fstream": "^1.0.12",
"materialize-css": "^1.0.0",
"moment": "^2.24.0",
"querystringify": "^2.1.1",
"react": "^16.8.6",
"react-copy-to-clipboard": "^5.0.1",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"react-scripts": "^3.0.1",
Expand All @@ -29,8 +33,5 @@
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0"
}
"devDependencies": {}
}
2 changes: 2 additions & 0 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="msapplication-TileColor" content="#424242">
<meta name="theme-color" content="#424242">
<meta name="robots" content="noindex">
<title>Yo - The URL Shortener</title>
</head>
<body class="grey darken-3">
Expand All @@ -32,6 +33,7 @@
/* Enable Materialize Tabs */
$(document).ready(function(){
$('ul.tabs').tabs();
$('.modal').modal();
});
</script>
</body>
Expand Down
2 changes: 2 additions & 0 deletions client/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /
7 changes: 5 additions & 2 deletions client/src/APIHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import axios from "axios";
import constants from "./config/config";
axios.defaults.baseURL = constants.apiUrl;

var accessToken = localStorage.getItem("accessToken");
const headers = { 'Content-Type': 'application/json', 'Authorization': "Bearer " + accessToken }

export const createShortUrl = obj => {
const requestUrl = "item";
return axios.post(requestUrl, obj);
const requestUrl = "link";
return axios.post(requestUrl, obj, {headers: headers});
};
4 changes: 4 additions & 0 deletions client/src/components/home/Home.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,8 @@ td {
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}

i.small {
font-size: 1.5rem;
}
Loading

0 comments on commit c7348e5

Please sign in to comment.