This project is experimental to learn new technologies and to have fun. It is not intended to be used in production. WORK IN PROGRESS!!!
This project consists in two parts.
npm run scrape
. This will create or update a characters.json
file in the db directory. npm run dev:api
to start the API locally on url http://localhost:8787/.npm run dev
. This will start the frontend on url http://localhost:3000/.Returns API available endpoints
Returns all characters with pagination. The default page size is 10. You can change the page size by adding a limit
query parameter. You can also change the page by adding a page
query parameter. Giving a limit
parameter with -1
will return all characters.
Response object is like this example:
{
"total": 444,
"pages": 45
"limit": 10,
"items": [
{
"id": 1,
"name": "Johnny Galecki",
"photo": "https://m.media-amazon.com/images/M/MV5BNzQ2ODY0MTIwMV5BMl5BanBnXkFtZTcwNDQ2NzMzMw@@._V1_UX266.jpg",
"charName": "Leonard Hofstadter",
},
...
]
}
Returns all episodes for a character. The charId
is the id of the character. The default page size is 10. You can change the page size by adding a limit
query parameter. You can also change the page by adding a page
query parameter. Giving a limit
parameter with -1
will return all episodes.
Response object is like this example:
{
"total": 280,
"pages": 28,
"limit": 10,
"items": [
{
"id": 0,
"text": "The Stockholm Syndrome (2019) ... Leonard Hofstadter",
"url": "https://www.imdb.com/title/tt6674736/?ref_=ttfc_fc_cl_i1"
},
...
]
}
Searches for characters by name or charName. Query parameter q
is required with at least 3 chars.