Skip to content

Commit

Permalink
add thought endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bramses committed Oct 11, 2023
1 parent 08b449e commit c17f990
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import bodyParser from 'body-parser';
import { similaritySearch } from './similarity-search.js';
import { sharePic } from './share-pic.js';
import { fetchRandomHighlight, fetchRandomHighlightInBookID } from './get-random-highlight.js';
import { addThoughtToHighlight } from './add-thought-to-highlight.js';


const app = express();
Expand Down Expand Up @@ -37,6 +38,15 @@ app.post('/search', async (req, res) => {
res.send(results)
})

app.post('/add-thought', async (req, res) => {
console.log(req.body)
const highlightId = req.body.highlightId
const thought = req.body.thought
const userId = req.body.userId
const result = await addThoughtToHighlight(highlightId, thought, userId)
res.send(result)
}

app.post('/share', async (req, res) => {
// console.log(req.body)
const url = req.body.url
Expand Down

0 comments on commit c17f990

Please sign in to comment.