I made an API about myself as a web developer and human

I have really been focusing my efforts on learning web development on backend lately. It is the most interesting to me. I’m not really a fan of creating interfaces and dealing with moving elements of a page a few pixels at a time until it looks right on one of a million different devices. I just like making connections between things and moving data between them. I also rally enjoy making command line apps where I don’t have to worry about a UI, but that is for another post.

Since I have been focusing on backend / API work I figured it would be fun to build an API that could be used as a resource to learn about me and what I have done in my self-taught journey. It would help me learn further and would be a fun talking piece. Plus, I think it would be hilarious if someone asked for a resume and I gave them a URL for them to make a GET request to for the appropriate info.

I started out making a JSON object to describe me as a web developer. I also threw in some fun personal stuff to ensure someone making requests for it that I am indeed a human being. It was both weird and fun to create this data structure that is supposed to represent me. Once I had that mostly complete I installed Express to the project and began building out the routes for the API. This part was pretty simple as I am only supporting making GET requests for this API since I don’t want someone changing data about me unless it is me making the changes.

The necessary data for this API is pretty simplistic and since I don’t need to write new data or update existing via requests I decided that implementing a database like MongoDB would be overkill. Instead I decided on just creating JSON files with the necessary data for each route to return. I have a main route that provides a brief explanation of the API and the available endpoints. I have my resume style object in another JSON file. This way requests made to the appropriate endpoint will quickly return data. I even made a JSON file for custom errors that I require in each route file so that I can give a custom error message when someone attempts a request other than a GET.

Along with providing info about myself I also setup a /fun endpoint to provide info about fun things that can be done with the API. I am saving this part of the project for the silly ideas I have for micro-services to do hilariously “useful” things. The first one is /api/band-names which returns a listing of awesome band names I have created, each with their own id number. You can use /api/band-names/{{id}} to return a specific band name based on its id number. This spawned a separate project to create this object. Since I don’t have a database generating the id numbers for me I needed a way to create them. I keep this list of band names in a sheet in Smartsheet. I used the Auto-Number system column to generate unique five digit numbers for each name. Then I build a script that connects to the sheet and builds out an object with the id numbers and name. This object is then written out to a JSON file that I copied into my data directory along with the other necessary JSON files. Now, as I come up with other fun ideas for micro-services I can place them in as part of this API.

This was a really fun project to make and it helped me learn a lot more about Express and building out the backend of an app. Next up I am going to build out a simple CRUD API that connects to a MongoDB database. This will be a more typical API that handles GET / PUT / POST / DELETE requests. At first I was thinking that I would base it around the ideas of todos for a todo list, but instead I’m going to go with robots. That sounds more fun.

If you are interested in checking out my API about me you can find it here:

https://daveskull.herokuapp.com

And the project can be found on Github here:

https://github.com/daveskull81/daveskull-api

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s