better docs

This commit is contained in:
sairaj mote 2024-01-11 20:49:34 +05:30
parent 5b2eb12e86
commit cf35cfd15d
3 changed files with 17 additions and 4 deletions

View File

@ -37,6 +37,9 @@ app.get("/", (req, res) => {
font-size: 2rem;
margin-bottom: 2rem;
}
a{
color: inherit;
}
table {
border-collapse: collapse;
}
@ -74,7 +77,9 @@ app.get("/", (req, res) => {
Available endpoints:
</h3>
<ul>
<li>/price-history</li>
<li>
<a href="/price-history">/price-history</a>
</li>
</ul>
<h3>
Query parameters:
@ -224,7 +229,7 @@ app.post("/price-history", async (req, res) => {
if (!Array.isArray(dates)) {
return res.status(400).json({ error: 'dates must be an array' });
}
const priceHistory = await PriceHistory.find({ date: { $in: dates } }, { _id: 0, __v: 0 });
const priceHistory = await PriceHistory.find({ date: { $in: dates } }, { _id: 0, __v: 0, asset: 0 });
res.json(priceHistory);
} catch (err) {
console.log(err);

2
index.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -2,4 +2,12 @@ GET http://localhost:3000/
###
GET http://localhost:3000/price-history?limit=10&currency=inr
GET http://localhost:3000/price-history?limit=10
###
POST http://localhost:3000/price-history
Content-Type: application/json
{
"dates": ["2021-01-01", "2021-01-02", "2021-01-03", "2021-01-04", "2021-01-05", "2021-01-06", "2021-01-07", "2021-01-08", "2021-01-09", "2021-01-10"]
}