1use axum::{routing::get, Json, Router};
2use serde::Serialize;
3
4#[tokio::main]
5async fn main() {
6    let spencer_bartholomew = SpencerBartholomew {
7        skills: vec![
8            Skill {
9                name: "Rust".to_string(),
10                description: "I've been using Rust for a long time now and I have built many production applications using it. I've contributed to various open-source Rust libraries as well.".to_string(),
11            },
12            Skill {
13                name: "Postgres".to_string(),
14                description: "I have used Postgres extensively for years. At Brevity, I deployed a solution that would deploy, manage, and branch postgres databases for our clients. I am extremely familiar with the ins and outs of Postgres.".to_string(),
15            },
16        ],
17        experience: vec![
18            Experience {
19                title: "Software Engineer".to_string(),
20                company: "Brevity".to_string(),
21                start_date: "Feb 2023".to_string(),
22                end_date: EndDate::Present,
23                company_description: "Brevity is a full-stack, no-code, web-app builder. We've just raised a couple million to build the worlds best way to build apps.".to_string(),
24                job_description: "I work on everything from payments, to backend microservices, to multitenant backend and database resource managment. I am mainly using Rust, TypeScript, and Postgres and working with platforms such as Cloudflare and fly.io.".to_string(),
25            },
26            Experience {
27                title: "Software Engineering Lead / Co-Founder".to_string(),
28                company: "Leftovers".to_string(),
29                start_date: "Aug 2022".to_string(),
30                end_date: EndDate::Date("Jan 2023".to_string()),
31                company_description: "Leftovers was a VC backed marketplace that helped restaurants and grocery stores sell their excess food to consumers. We exited to a larger company in January 2023.".to_string(),
32                job_description: "I lead our team of engineers to build out the marketplace. We used Next.js with TypeScript on the frontend, Rust on the backend, and Postgres as our database.".to_string(),
33            },
34            Experience {
35                title: "Software Engineer".to_string(),
36                company: "Neighbor".to_string(),
37                start_date: "April 2022".to_string(),
38                end_date: EndDate::Date("Aug 2022".to_string()),
39                company_description: "Neighbor is AirBnb for storage.".to_string(),
40                job_description: "Most of my time was spent building various microservices in Go with Postgres, Redis, ElasticSearch, and DynamoDB".to_string(),
41            }
42        ],
43        education: Education {
44            school: "Brigham Young University".to_string(),
45            degree: "B.S. Computer Science".to_string(),
46            start_date: "2020".to_string(),
47            end_date: "2024".to_string(),
48            description: "I studied computer science at BYU and participated in BYU's Sandbox program where I started and sold a tech company called Leftovers".to_string(),
49        },
50    };
51
52    let app = Router::new()
53        .route(
54            "/",
55            get(|| async { "Hello, world! Welcome to my website." }),
56        )
57        .route("/spencer", get(|| async { Json(spencer_bartholomew) }));
58
59    axum::Server::bind(&"0.0.0.0:8080".parse().unwrap())
60        .serve(app.into_make_service())
61        .await
62        .unwrap();
63}
64
65#[derive(Serialize, Clone)]
66struct SpencerBartholomew {
67    skills: Vec<Skill>,
68    experience: Vec<Experience>,
69    education: Education,
70}
71
72#[derive(Serialize, Clone)]
73struct Skill {
74    name: String,
75    description: String,
76}
77
78#[derive(Serialize, Clone)]
79struct Experience {
80    title: String,
81    company: String,
82    start_date: String,
83    end_date: EndDate,
84    company_description: String,
85    job_description: String,
86}
87
88#[derive(Serialize, Clone)]
89enum EndDate {
90    Present,
91    Date(String),
92}
93
94#[derive(Serialize, Clone)]
95struct Education {
96    school: String,
97    degree: String,
98    start_date: String,
99    end_date: String,
100    description: String,
101}
102