Mainly just a place to dump of the awful jokes I've collected over the years and I encourage other people to add to them :D
Following along to the https://remix.run/docs/en/v1/tutorials/jokes tutorial to get to grips with the Remix.js indie stack and deploying my app with a mariadb instance through Docker.
cp .env.example .env
.env
with your values - be sure the environment is set to something other than production
, MYSQL_HOST
is set to localhost
and the DATABASE_URL
uses the MYSQL_LOCAL_PORT
docker-compose build db
to build the database containerdocker-compose up -d db
to spin up the database containernpm install
npm run dev
npm run prisma:flush
cp .env.example .env
.env
with your values - be sure the environment is set to production, MYSQL_HOST
is set to your db container name and the DATABASE_URL
uses the MYSQL_DOCKER_PORT
docker-compose build
to build the containersdocker-compose up -d
to spin up the containersdocker-compose exec app bash
npm run prisma:flush
/api/jokes/?showNsfw=<boolean>
This will give you the JSON for a random joke.
Optional param showNsfw
will filter jokes accordingly based on whether they contain content that is "safe for work" or not.
An example request to grab a random joke may look like this:
const response = await fetch(
'https://jokes.timbryan.dev/api/jokes?showNsfw=true',
)
if (response.status === 200) {
const data = await response.json()
const { content } = data.randomJoke
console.log(content)
}
Where the JSON data being returned may look like:
{
"randomJoke": {
"id": "<uuidv4 string>",
"jokesterId": "<uuidv4 string>",
"createdAt": "<DateTime as ISO string>",
"updatedAt": "<DateTime as ISO string>",
"name": "Banana",
"content": "Why did Billy get fired from the banana factory? He kept throwing away the bent ones.",
"nsfw": false
},
"jokester": "TimBryan"
}
/api/jokes/:id
This will give you the JSON for a specific joke matching the provided ID.
An example of a request to grab a specific joke may look like this:
const response = await fetch(
'https://jokes.timbryan.dev/api/jokes/37df94f6-0ed2-4ea0-8ec6-3834af011e11',
)
if (response.status === 200) {
const data = await response.json()
const { content } = data.joke
console.log(content)
}
Where the JSON data being returned may look like:
{
"joke": {
"id": "<uuidv4 string>",
"jokesterId": "<uuidv4 string>",
"createdAt": "<DateTime as ISO string>",
"updatedAt": "<DateTime as ISO string>",
"name": "Banana",
"content": "Why did Billy get fired from the banana factory? He kept throwing away the bent ones.",
"nsfw": false
},
"jokester": "TimBryan",
"isJokeOwner": false
}
/login
route./jokes
route with the Set-Cookie
header.