Giter Site home page Giter Site logo

laura-dern-api's Introduction

Laura Dern API

About

Laura Dern API is an open source API dedicated to our LGBTQ icon Laura Dern. You will have access to all her shows and movies, images, characters, and years.

Live Site

current_view

Who Am I

Zeyao Li, a master candidate at NYU ITP

Built With

I'm using Node.js and express to serve the API, neDB and PostMan to manage the database. I am hosting this site on Glitch.

Process & Documentation

Four Steps: Laura Dern API backend with JSON file -> neDB (transfer JSON to db) -> update the backend with DB -> front-end develop ment

First step - API & JSON

I started designing the API by listing what kind of the data that I need. It's like doing a structure for JSON file. On this step, I just simply wrote down some words on my notebook and linked together. It doesn't have to be 100% accurate and can always change it.

Then I went on imdb.com and grabbed a few data to create the JSON file. The JSON file structures like one object "data" that contains an array of different objects (lists) of what Laura Dern acted before. In each objects, there are "type", "name", "year", "character", and "img" to have access.

I used node and express to serve the api with the json file. Here I used "path" and "fs" library from node to locate the file and read/write it.

Up to this step, the server can read all the data that I put it in. I created a super simple front-end page to display all the movie names before moving to the next step.

Second Step - API & DataBase

I started a new folder that contains neDB, a back-end script and the JSON file. Simply, I read the json file and used array map function to return json objects with name "list". Then I inserted the object to the database.

After that, I switched back to the API folder that I had and put the database file in. I replaced the json write and read with neDB in the function that gets and pushes data. There is currently only one endPoint "/api", however, I decided to add more soon. I used PostMan for managing data (mainly post it and update).

Third Step: Front-end Development

This time, I wrote totally reusable UI component for the API front-end page. There are only 3 lines in the body html code which gives a root div for putting stuff in. Rest of the page are built in Javascript (like react). It actually takes me a while to figure out how to retrieve data from the database and store it in global variable to use, which I didn't at the end. I put all the component inside the fetch so I can use the variable inside the scope. Creating reusable components definitely makes life way better. I only need to create card once and put all the data in, then every time I publish a new data into database, it automatically updates.

Next Step

More Endpoints - random, awards...

Sorting and Filter function on front end

Better code structure

laura-dern-api's People

Contributors

zeyaoli avatar

Watchers

James Cloos avatar  avatar

Forkers

yitingliu97

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.