Giter Club home page Giter Club logo

node-cv-app's Introduction

Node CV App

Morning!

We've set up another repository for you to fork (grab a mentor if you're curious or confused about all the boilerplate).

Goal

Remember the CV you made all those months ago? This week you will be building an updated version powered by Node.js. You will fetch data from a real-world API (the Github API), perform some operations on that data, and then use it to populate Handlebars templates (this should sound familiar, because you did a similar thing last week). Finally, you will deploy your CV to the internet.

Practical tasks

API client

  • complete the fetchFromGithub method in /server/lib/github-client.js so that the should retrieve user profile information test passes
  • /users/{username}/events/public is a github endpoint that returns all a user's activity on github. Use this, and the documentation about event types https://developer.github.com/v3/activity/events/types/, to add a getUserPullRequests method to the github client which retrieves a list of a user's pull requests. The should retrieve user pull requests test should pass.

Controllers

  • Set up a CV controller that outputs your existing HTML CV, using Handlebars templates (if you don't have your existing CV, make a simple one)
  • Add your Github user profile and pull request information to this page by using the Github client

Middleware

  • add error handling middleware to send a 404 if the user requests some url not supported by your app, or 503 error if anything goes wrong

Questions to think about

  • What approaches can you use to make it easier to work with complex data like the responses from the Github API?
  • Why haven't we written all the code in a single app.js file?
  • Why are we passing your Github user name from the controller to the github client? Why don't we just 'hard code' it into the github client?
  • How are controllers and middleware different? How are they similar?

Extension tasks

  • use ?format=json query string to send a json only response
  • set up a user controller to send the same information, minus your CV, for any user. Try to minimise how much you copy and paste code - can some of the code you wrote be extracted into another shared module in your /lib directory
  • using the documentation, find some other interesting data from the github api to put in your CV. Use Promise.all() to wait for all your api calls to respond, and output all the data in your CV page
  • extend your error middleware to send a custom 404 response if a user is not found

Deploying to Heroku

Important concepts

  • Modular JavaScript:
    • D.R.Y.
    • require and module.exports
    • how and why to split your code out of server.js into app.js, controllers/, lib/
  • Error handling
    • status codes: 404 vs 503
  • The lifecycle of a request and response in express
    • Middleware: app.use()
    • Routes: app.get(), app.post() etc.
    • Route handling with Controllers
    • sending a response: response.render(), response.json(), response.send() etc.
    • what are the req & res objects doing, really?
  • Requesting and using complex data from real-world APIs
    • doing async operations with callbacks and promises
    • useful methods for dealing with JS data structures
    • using documentation

node-cv-app's People

Contributors

alexfdz avatar inennes avatar nabilwardeh avatar theoleanse avatar wheresrhys avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-cv-app's Issues

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.