better docs
This commit is contained in:
parent
5b2eb12e86
commit
cf35cfd15d
9
index.js
9
index.js
@ -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
2
index.min.js
vendored
File diff suppressed because one or more lines are too long
10
test.rest
10
test.rest
@ -2,4 +2,12 @@ GET http://localhost:3000/
|
||||
|
||||
###
|
||||
|
||||
GET http://localhost:3000/price-history?limit=10¤cy=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"]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user