-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding prettier * prettier remediation * audit remediation * adding c8 for coverage
- Loading branch information
Showing
15 changed files
with
1,529 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,20 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"es6": true, | ||
"node": true | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, | ||
}, | ||
extends: 'eslint:recommended', | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"never" | ||
] | ||
} | ||
}; | ||
sourceType: 'module', | ||
}, | ||
rules: { | ||
indent: ['error', 2], | ||
'linebreak-style': ['error', 'unix'], | ||
quotes: ['error', 'single'], | ||
semi: ['error', 'never'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,88 @@ | ||
# ineedagyro-js | ||
|
||
Gyros near you! | ||
|
||
https://www.ineedagyro.com | ||
|
||
## How? | ||
|
||
Uses browser's `navigation.geolocation.getCurrentPosition()` to query [Yelp's Fusion API](https://www.yelp.com/developers/documentation/v3/business_search) using [yelp-fusion](https://github.com/Yelp/yelp-fusion). | ||
|
||
## Run | ||
|
||
1. Get API ID and secret from [Yelp](https://www.yelp.com/developers/v3/manage_app) | ||
1. Set those values in your environment | ||
See https://www.yelp.com/developers/v3/manage_app | ||
See https://www.yelp.com/developers/v3/manage_app | ||
|
||
```bash | ||
export YELP_API_KEY=<your_yelp_API_ID> | ||
``` | ||
|
||
### Using npm directly | ||
|
||
```bash | ||
npm install | ||
npm start | ||
``` | ||
|
||
### Using Docker | ||
|
||
#### Build | ||
|
||
To ensure you're not using an out-of-date image | ||
|
||
```bash | ||
docker compose build | ||
``` | ||
|
||
#### Run | ||
|
||
```bash | ||
docker compose up -d | ||
``` | ||
|
||
Then browse to http://localhost:8080/ | ||
|
||
#### Other options | ||
|
||
If you want to view logs, omit `-d` from the previous command _or_ | ||
|
||
```bash | ||
docker compose logs -f | ||
``` | ||
|
||
## Test | ||
|
||
Make sure karma-chrome-launcher is installed. This may cause problems with CI. | ||
|
||
```bash | ||
npm install karma-chrome-launcher --save-dev --link | ||
``` | ||
|
||
```bash | ||
Run tests | ||
``` | ||
|
||
```bash | ||
npm test | ||
``` | ||
|
||
will run mocha for the server-side JavaScript and karma for the client-side tests | ||
|
||
## Helpy things | ||
|
||
### cURL | ||
|
||
#### Call with token | ||
|
||
Export the Yelp token you received (see above) | ||
`export YELP_API_KEY=<see_get_token_section>` | ||
then execute the request | ||
|
||
```bash | ||
curl -H "Authorization: Bearer $YELP_API_KEY" https://api.yelp.com/v3/businesses/search?location=48226&term=gyro | ||
``` | ||
|
||
### Chrome location permissions reset | ||
|
||
https://support.google.com/chrome/answer/114662?co=GENIE.Platform%3DDesktop&hl=en |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import express from 'express' | ||
import bodyParser from 'body-parser' | ||
import express from 'express'; | ||
import bodyParser from 'body-parser'; | ||
|
||
let app = express() | ||
let app = express(); | ||
|
||
import indexRoutes from './routes/index.js' | ||
app.use(indexRoutes) | ||
import indexRoutes from './routes/index.js'; | ||
app.use(indexRoutes); | ||
|
||
app.set('view engine', 'ejs') | ||
app.use(bodyParser.urlencoded({extended: true})) | ||
app.use(express.static('./public')) | ||
app.set('view engine', 'ejs'); | ||
app.use(bodyParser.urlencoded({ extended: true })); | ||
app.use(express.static('./public')); | ||
|
||
const port = process.env.PORT || 8080 | ||
export default app.listen(port, function(){ | ||
console.log('listening at ' + port) | ||
}) | ||
const port = process.env.PORT || 8080; | ||
export default app.listen(port, function () { | ||
console.log('listening at ' + port); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.