Skip to content

Commit

Permalink
Cool job dude
Browse files Browse the repository at this point in the history
  • Loading branch information
samrocksc committed Aug 31, 2023
1 parent dcdd02d commit 22dbc7f
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 1,159 deletions.
1,080 changes: 0 additions & 1,080 deletions api/Cargo.lock

This file was deleted.

15 changes: 0 additions & 15 deletions api/Cargo.toml

This file was deleted.

38 changes: 0 additions & 38 deletions api/awesome.go

This file was deleted.

46 changes: 46 additions & 0 deletions api/awesome.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use rand::prelude::*;
use serde_json::json;
use vercel_runtime::{run, Body, Error, Request, Response, StatusCode};

#[tokio::main]
async fn main() -> Result<(), Error> {
run(handler).await
}

pub async fn handler(_req: Request) -> Result<Response<Body>, Error> {
Ok(Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "application/json")
.body(
json!({
"joke": get_joke()
})
.to_string()
.into(),
)?)
}

fn pick_random_string(list_of_strings: &[&str]) -> String {
let mut rng = rand::thread_rng();
list_of_strings[rng.gen_range(0..list_of_strings.len())].to_string()
}

fn get_joke() -> String {
let list_of_jokes = [
"<h2>I'm a big fan of whiteboards. I find them quite....re-markable.</h2>",
"<h2>I ate a clock yesterday, it was very time-consuming.</h2>",
"<h2>How did the picture end up in jail? It was framed!</h2>",
"<h2>I got a joke about sausage, it's the <i>wurst</i></h2>",
"<h2>I have joke about paper, it's <i>terrible</i></h2>",
"<h2>Cactus puns are simply succulent.</h2>",
"<h2>What do you call a tall pile of cats?......A <i>meowntain</i></h2>",
"<h2>Why couldn't the bicycle stand up?....because it was too tired</h2>",
"<h2>What concert costs 45 cents? 50 cent ft. <i>Nickleback</i></h2>",
"<h2>What did the buffalo say when his son left? Bison!</h2>",
"<h2>What do you call a pig that knows karate? A porkchop!</h2>",
"<h2>what does a vegetarian zombie eat? GRAINNSS</h2>",
"<h2>did you hear the one about the vacuum? it sucks.</h2>",
"<h2>I made a pun about wind, but it blows</h2>",
];
return pick_random_string(&list_of_jokes);
}
3 changes: 0 additions & 3 deletions api/go.mod

This file was deleted.

20 changes: 20 additions & 0 deletions api/handler.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use serde_json::json;
use vercel_runtime::{run, Body, Error, Request, Response, StatusCode};

#[tokio::main]
async fn main() -> Result<(), Error> {
run(handler).await
}

pub async fn handler(_req: Request) -> Result<Response<Body>, Error> {
Ok(Response::builder()
.status(StatusCode::OK)
.header("Content-Type", "application/json")
.body(
json!({
"message": "testing"
})
.to_string()
.into(),
)?)
}
20 changes: 0 additions & 20 deletions api/possum.rs

This file was deleted.

3 changes: 0 additions & 3 deletions api/src/main.rs

This file was deleted.

1 comment on commit 22dbc7f

@vercel
Copy link

@vercel vercel bot commented on 22dbc7f Aug 31, 2023

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:

radjokes – ./

radjokes-git-main-samrocksc.vercel.app
radjokes-samrocksc.vercel.app
cowabunga.dev
radjokes.vercel.app

Please sign in to comment.