Skip to content

Commit

Permalink
Merge pull request #1 from Steppico/fix/updates-and-improvements
Browse files Browse the repository at this point in the history
Fix/updates and improvements
  • Loading branch information
ywalia01 committed Dec 5, 2021
2 parents cb3622c + 9269411 commit ae4ff1d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ Returns an array with `{number}` quotes e.g. `GET /quotes/3`.
}
]

### `GET /quote/{id}`
### `GET /quotes/id/{id}`

Get the corresponding quote from its `id` in this format:

> [https://the-dune-api.herokuapp.com/quote/40](https://the-dune-api.herokuapp.com/quote/40)
> [https://the-dune-api.herokuapp.com/quotes/id/66](https://the-dune-api.herokuapp.com/quotes/id/66)
[
{
id: "96",
id: "66",
"quote": "A man's flesh is his own; the water belongs to the tribe.",
}
]
Expand Down Expand Up @@ -103,11 +103,11 @@ Returns an array with `{number}` books e.g. `GET /books/3`.
}
]

### `GET /book/{id}`
### `GET /books/id/{id}`

Get the corresponding book from its `id` in this format:

> [https://the-dune-api.herokuapp.com/book/1](https://the-dune-api.herokuapp.com/book/1)
> [https://the-dune-api.herokuapp.com/books/id/1](https://the-dune-api.herokuapp.com/books/id/1)
[
{
Expand Down
24 changes: 12 additions & 12 deletions loaders/getArticle.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ function getRandom(type, number) {

function getArticle(type, id) {
if (type == 'quotes') {
if (id < 0) {
return quotes[1]
if (id <= 0) {
return quotes[0]
}
else if (id > quotes.length) {
return quotes[quotes.length - 1]
Expand All @@ -94,8 +94,8 @@ function getArticle(type, id) {
}
}
else if (type == 'books') {
if (id < 0) {
return books[1]
if (id <= 0) {
return books[0]
}
else if (id > books.length) {
return books[books.length - 1]
Expand All @@ -105,8 +105,8 @@ function getArticle(type, id) {
}
}
else if (type == 'movies') {
if (id < 0) {
return movies[1]
if (id <= 0) {
return movies[0]
}
else if (id > movies.length) {
return movies[movies.length - 1]
Expand All @@ -116,8 +116,8 @@ function getArticle(type, id) {
}
}
else if (type == 'series') {
if (id < 0) {
return series[1]
if (id <= 0) {
return series[0]
}
else if (id > series.length) {
return series[series.length - 1]
Expand All @@ -127,8 +127,8 @@ function getArticle(type, id) {
}
}
else if (type == 'stories') {
if (id < 0) {
return shortStories[1]
if (id <= 0) {
return shortStories[0]
}
else if (id > stories.length) {
return shortStories[shortStories.length - 1]
Expand All @@ -138,8 +138,8 @@ function getArticle(type, id) {
}
}
else if (type == 'comics') {
if (id < 0) {
return comics[1]
if (id <= 0) {
return comics[0]
}
else if (id > comics.length) {
return comics[comics.length - 1]
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ app.get('/:type/id/:id?', function (req, res) {
});

app.get('/', (req, res) => {
res.status(200).status(200).send("Welcome to the DUNE API")
res.status(200).send("Welcome to the DUNE API")
});

app.listen(PORT, function () {
Expand Down

1 comment on commit ae4ff1d

@vercel
Copy link

@vercel vercel bot commented on ae4ff1d Jul 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dune-api – ./

dune-api-git-main-ywalia01.vercel.app
dune-api-ywalia01.vercel.app
dune-api.vercel.app

Please sign in to comment.