Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abheekda1/nerd-jokes-api
A nerdy API for categorized jokes, heavily focused on science puns!
https://github.com/abheekda1/nerd-jokes-api
api go golang jokes science
Last synced: 6 days ago
JSON representation
A nerdy API for categorized jokes, heavily focused on science puns!
- Host: GitHub
- URL: https://github.com/abheekda1/nerd-jokes-api
- Owner: abheekda1
- License: apache-2.0
- Created: 2021-03-29T14:59:54.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-03-29T17:50:22.000Z (over 3 years ago)
- Last Synced: 2024-06-19T05:33:26.599Z (5 months ago)
- Topics: api, go, golang, jokes, science
- Language: Go
- Homepage: https://jokes.adawesome.tech
- Size: 19.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nerd Jokes API
A nerdy API for categorized jokes, heavily focused on science puns!## About
I was looking around for jokes APIs, but couldn't find any that had science jokes that I could request for specifically. As I had just started learning golang, I decided to waste an entire day making a crappy, useless API that has ugly code and probably has tons of extra garbage - but it works!## Usage
To use it, just clone the repository and run either `go run main.go` for a quick test or `go build main.go` and `./main` for use in production. By default, it runs on port 3587 (as I use a reverse proxy for that port to be accesed by a certain domain) but this can be modified in the `main.go` file.### Requesting jokes
You can take a look at the endpoints in the `main.go` file, but here are the main ones: `/jokes/random`, `/jokes/random/{subject}`, `/jokes/{subject}` and `/jokes`. These only work with GET requests.### Adding jokes
You can send a POST request to the `/addJoke` endpoint with only the fields that have content (take a look at `jokes.json` for the format). For example, you can have
```
{
apikey: 'specified on start',
subject: 'subject',
setup: 'funny joke',
punchline: 'lol lol'
}
```
instead of specifying each field if it isn't used. Postman is easy to use for this but cURL also works.
> Note: the API Key is specified on the launching of the program. For example `./main [API Key here]`.