Skip to content

Commit

Permalink
Code formatting (#18)
Browse files Browse the repository at this point in the history
* eslint fixes
* Prettier formatting
  • Loading branch information
KevinNovak authored Dec 1, 2019
1 parent 2fb65fa commit 6c41614
Show file tree
Hide file tree
Showing 11 changed files with 527 additions and 436 deletions.
30 changes: 16 additions & 14 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
const _express = require('express');
const _express = require("express");
const _app = _express();
const _bodyParser = require('body-parser');
const _httpClient = require('./services/http-client');
const _steamScraper = require('./services/steam-scraper');
const _logger = require('./services/logger');
const _bodyParser = require("body-parser");
const _httpClient = require("./services/http-client");
const _steamScraper = require("./services/steam-scraper");
const _logger = require("./services/logger");

const PORT = process.env.PORT || 8080;

function main() {
_app.use(_express.static('public'));
_app.use(_bodyParser.urlencoded({ extended: false }))
_app.use(_express.static("public"));
_app.use(_bodyParser.urlencoded({ extended: false }));
_app.use(_bodyParser.json());

_app.post('/api/app-scrape', async (req, res) => {
_app.post("/api/app-scrape", async (req, res) => {
let appUrl = req.body.url;

let appPageHtml;
try {
appPageHtml = await _httpClient.get(appUrl);
} catch (error) {
_logger.error(error);
res.status(500).json({ message: "Error retrieving page HTML." })
res.status(500).json({ message: "Error retrieving page HTML." });
return;
}

Expand All @@ -40,19 +40,21 @@ function main() {
}
});

_app.post('/api/search-scrape', async (req, res) => {
_app.post("/api/search-scrape", async (req, res) => {
let searchUrl = req.body.url;
let searchPageHtml;
try {
searchPageHtml = await _httpClient.get(searchUrl);
} catch (error) {
_logger.error(error);
res.status(500).json({ message: "Error retrieving page HTML." })
res.status(500).json({ message: "Error retrieving page HTML." });
return;
}

try {
let searchPageData = _steamScraper.getSearchPageData(searchPageHtml);
let searchPageData = _steamScraper.getSearchPageData(
searchPageHtml
);
res.status(200).json(searchPageData);
return;
} catch (error) {
Expand All @@ -62,14 +64,14 @@ function main() {
}
});

_app.post('/api/search-app-scrape', async (req, res) => {
_app.post("/api/search-app-scrape", async (req, res) => {
let appUrl = req.body.url;
let appPageHtml;
try {
appPageHtml = await _httpClient.get(appUrl);
} catch (error) {
_logger.error(error);
res.status(500).json({ message: "Error retrieving page HTML." })
res.status(500).json({ message: "Error retrieving page HTML." });
return;
}

Expand Down
76 changes: 38 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
{
"name": "vr-game-deals-tools",
"version": "1.0.0",
"description": "Tools for r/vrgamedeals",
"main": "app.js",
"scripts": {
"start": "node app.js",
"start-pm2": "pm2 start process.json",
"dev": "nodemon app.js"
},
"keywords": [
"deals",
"game",
"reality",
"virtual",
"vr",
"vrgamedeals"
],
"author": "Kevin Novak",
"license": "MIT",
"dependencies": {
"body-parser": "^1.19.0",
"cheerio": "1.0.0-rc.3",
"express": "4.17.1",
"pm2": "^3.5.1",
"request": "2.88.0",
"request-promise": "4.2.4"
},
"devDependencies": {
"nodemon": "^1.19.4"
},
"homepage": "https://github.com/KevinNovak/vrgamedeals-Tools#readme",
"repository": {
"type": "git",
"url": "https://github.com/KevinNovak/vrgamedeals-Tools.git"
},
"bugs": {
"url": "https://github.com/KevinNovak/vrgamedeals-Tools/issues"
}
"name": "vr-game-deals-tools",
"version": "1.0.0",
"description": "Tools for r/vrgamedeals",
"main": "app.js",
"scripts": {
"start": "node app.js",
"start-pm2": "pm2 start process.json",
"dev": "nodemon app.js"
},
"keywords": [
"deals",
"game",
"reality",
"virtual",
"vr",
"vrgamedeals"
],
"author": "Kevin Novak",
"license": "MIT",
"dependencies": {
"body-parser": "^1.19.0",
"cheerio": "1.0.0-rc.3",
"express": "4.17.1",
"pm2": "^3.5.1",
"request": "2.88.0",
"request-promise": "4.2.4"
},
"devDependencies": {
"nodemon": "^1.19.4"
},
"homepage": "https://github.com/KevinNovak/vrgamedeals-Tools#readme",
"repository": {
"type": "git",
"url": "https://github.com/KevinNovak/vrgamedeals-Tools.git"
},
"bugs": {
"url": "https://github.com/KevinNovak/vrgamedeals-Tools/issues"
}
}
2 changes: 1 addition & 1 deletion process.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"log_date_format": "YYYY-MM-DD HH:mm:ss"
}
]
}
}
Loading

0 comments on commit 6c41614

Please sign in to comment.