Git Product home page Git Product logo

rendering-api's Introduction

Build an API for the Rendering assignent

Overview

Now that you have a feel for how to write a server using Express, we'll apply that knowledge to one of your prior front-end exercises. (It's the rendering exercise - Remember? The one where we rendered Circles, Tweets, and Albums? Yeah, that one!)

Let's take a quick tour of this repo:

package.json

The main things you should notice about package.json is that 1) express is listed as a dependency, and 2) you can run npm start to start this server

server.js

This is the server code! Notice that this server is currently only set up to server the files in the /public folder. You'll be doing your work in this file for this exercise.

/public

This folder contains all of the front end html, css, and javascript. It's nearly identical to the files in my repo called 'rendering'

/public/render**.js

Notice that each of the render functions make use of axios to fetch data from your server. (A couple weeks ago, there was no axios code here - instead, the abstractions were hardcoded as arrays and objects)

/abstractions

These files all contain the abstractions we're interested in. Notice that we export the abstractions with module.exports = .... These files are imported via require() statements in server.js

Your Assignment

  1. Install this project's depencies with npm install
  2. Run the server npm start
  3. Open localhost:3000 in Google Chrome
  4. Notice that the buttons don't work! That's because your buttons are trying to fetch data from the server at routes like /api/albums and /api/poker, but they aren't implemented yet!
  5. Implement these routes in server.js. Restart your server and verify that your server is properly serving the data!

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.