diff --git a/api/server.js b/api/server.js
index a31dc96..568ea1c 100644
--- a/api/server.js
+++ b/api/server.js
@@ -5,6 +5,7 @@ const cors = require('cors');
const config = require('../src/config.js');
const getData = require('./modules/getData.js');
const fs = require('fs');
+const fetch = require('cross-fetch');
const port = config.API.PORT;
@@ -35,16 +36,27 @@ app.get('/pdfs/:id', async (req, res) => {
app.post('/api', async (req, res) => {
const pageToVisit = req.body.link;
+ const id = req.body._id;
+ const getTitle = async(url) => {
+ let body;
+ await fetch(url)
+ .then(res => res.text())
+ .then(text => body = text)
+ // regular expression to parse contents of the
tag
+ let match = body.match(/([^<]*)<\/title>/);
+ return match[1];
+ }
try {
+ req.body.title = await getTitle(req.body.link);
+ await insertDoc(req.body);
+
+ res.send("DONE!");
+
const dataResult = await getData(pageToVisit, req.body._id);
- req.body.title = dataResult;
- insertDoc(req.body);
} catch (err) {
console.log(err);
insertDoc(req.body);
- } finally {
- res.send('Posted!');
}
});
diff --git a/src/styles/List.css b/src/styles/List.css
index 570c6d6..df7be41 100644
--- a/src/styles/List.css
+++ b/src/styles/List.css
@@ -37,7 +37,6 @@
}
.list-entity-content {
- text-shadow: 0px 1px 3px #1f2c38;
z-index: 0;
margin-left: 70px;
padding: 20px;
diff --git a/src/styles/ViewArchived.css b/src/styles/ViewArchived.css
index 45eebce..05c2f7a 100644
--- a/src/styles/ViewArchived.css
+++ b/src/styles/ViewArchived.css
@@ -6,5 +6,5 @@
.seperator {
width: 100%;
- color: white;
+ color: #1f2c38;
}
\ No newline at end of file
diff --git a/src/styles/index.css b/src/styles/index.css
index bbf2fea..b44e744 100644
--- a/src/styles/index.css
+++ b/src/styles/index.css
@@ -6,9 +6,9 @@ body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: #1f2c38;
+ text-shadow: 0px 1px 1px #1f2c38;
}
*::selection {
background-color: rgba(255, 255, 0, 0.6);
- text-shadow: 0px 1px 3px #1f2c38;
}
\ No newline at end of file