Building A Small Node API On Glitch | Tiffany R. White Blog

Building A Small Node API On Glitch

Reading time: 1 min

At the end of last year, I decided I wanted to try my hand at building and consuming my own API.

First, I needed to decide what data I was going to use. Second, I needed a place to host the API, and third, I needed someplace to consume the API and display it.

I knew the stack I was going to use on the backend: Node.js and Express. I decided that I’d host it on Glitch1 as a simple, free way to create a proof-of-concept API.

The data

I used Faker.js’s API to create dummy data for a list of contacts.

Using the API is as simple as calling a few methods in your response, for instance:

    address: faker.address.streetAddress(),
    bio: faker.lorem.sentence(),
    // image: faker.image.avatar()

Structure of the API

I have a directory called /api that holds my user.js that just holds the main route to the root of the project.

I also have a public directory that holds static files.

End result

This is really simple to build. Glitch helps you along but I already was familiar with writing APIs2. The Glitch project is below.

  1. I made an account, remixed a couple projects that I never touched, and just didn’t know what to use Glitch for. I found one use at least. 

  2. Using tutorials so I wanted to do this myself and is part of the motivation for this whole project. 


No Ads. No Sponsored Content. Ever.

I've decided that I no longer want to have sponsored posts on this blog. I also, though as tempting as it may sound, don't want ads; even if I got big enough for Carbon ads I don't want them. I want to post free, engaging content for beginning/junior devs. This means that I won't have Setapp posts or affiliates on this blog, though I will keep them on the Uses page. If you enjoy the content, buy me a coffee. Just click the button below.

Coffee Buy me a coffeeBuy me a coffee

Webmentions 0

No webmentions were found.