Giter VIP home page Giter VIP logo

uf-directory-app-assignment's Introduction

Introduction to Front-end development with Angular.js

We will continue to build upon our directory application by creating a front-end interface with Angular.js to display listings, as well as the ability to add new listings and delete old ones.

HTML/CSS

HTML (HyperText Markup Language) is a markup language most commonly used to create web pages. CSS (Cascading Style Sheets) is used to describe the presentation of our HTML pages. HTML and CSS are used along with Javascript to create web applications both simple and complex alike.

Please go through this tutorial to learn the fundamentals of these two web technologies before continuing to the Bootstrap section. Keep in mind that this tutorial is very detailed and may take some time. Make sure to pay specific attention to:

  • The semantic nature of HTML
  • Layering CSS styles in a modular fashion using multiple classes
  • The box model
  • Positioning content with CSS

Bootstrap

While we could create our web application with just HTML, CSS, and Javascript, writing all of our styles from scratch would be tedious.

Say we have an application that will be used by desktop, tablet, and mobile users alike. Our CSS would have to be responsive, changing the layout of the page depending on the user's device. Luckily, we have Bootstrap, a responsive HTML/CSS/JS framework made by Twitter, to style our web applications. Bootstrap provides a grid system for easy layout and many components that will give the application a clean, modern, and consistent look.

Bootstrap's documentation is extensive, so don't worry about memorizing everything Bootstrap has to offer. If you understand the fundamentals of HTML and CSS, you should feel comfortable with the mechanics of the grid system and using classes to add styles to your HTML components. It'll be a better use of time to just refer back to the documentation whenever you need to add a new component to your webpage.

Model-View-Controller (MVC) Architecture

A common design pattern used for developing user interfaces is the model-view-controller architecture. As the name suggests, in this architecture the application is broken up into three main components:

  • The model is where the application's main data objects are stored.
  • The view presents models to the user, and allows the user to interact with the models
  • The controller interfaces between the model and the view
    • it updates models according to input provided by the user in the view
    • it updates the view when a model changes

The MVC concept has many variations and often does not exactly follow the pattern described above. You can take a look at this page for more information, or simply go a Google search for MVC architecture.

Angular.js

Angular.js is a MVC-based framework (maintained by Google) for developing web applications. Angular makes it (relatively) easy to start building an application by extending HTML so that the markup can describe not only the static webpage but also dynamic behavior.

Angular would be difficult to succintly describe in this readme. The framework certainly has a learning curve, and you should take some time going through tutorials to understand the basics. Below is a list of resources that may be helpful.

You do not need to go through all of these, just start to get familiar enough with Angular-specific concepts to complete this assignment, particularly the following:

Assignment

As before, We have provided skeleton code that will help guide you in completing this assignment.

Files provided in Assignment #2
  • index.html
  • app.js
  • listingController.js
  • listingFactory.js
  • README
  • style.css
  • package.json
Orientation to the files provided for this assignment:
  • In basic static HTML websites, index.html is the "homepage" or "landing page" when you visit a website. In node web applications, both index.html and app.js are used.
  • Index.html has a basic template for the page and references the CSS frameworks is used to control the style of the content on the landing page. Thus, the index.html is the view that the user sees.
  • app.js registers the dependencies (i.e., modules needed to run the app).
  • style.css - is the style formatting used to design the look and feel of the index.html page
  • listingController.js - is a file that holds the code that Angular.js uses to control what is rendered on the browser in response to a user's interaction with the website
  • listingFactory.js - is that same content that we had in our listings.json file for Assignment #1 but formatted into an object that Angular.js can manipulate
  • README - You already know what this file contains.

Assignment Objectives

Your objective is to create the front-end of our UF Directory App that will display the listings and allow the user to add and delete old ones. To accomplish this you will:

  • modify the listingController.js file to display listings, as well as the ability to add new listings and delete old ones.

Tasks

Take a look at the source code provided to you, and map out how the different files communicate with one another. You will notice there is a factory, a controller, and a view (provided by the index.html page). It is your responsibility to:

  1. Complete the methods in the controller
  2. Implement the prompts in the HTML view to make the application functional

Instructions:

  1. Fork this repository and then navigate to it on your local machine's terminal
  2. Implement the tasks listed above
  3. Check your that it works by looking at the index.html file in your favorit browser
  4. Points towards Project Bidding - Style your page using CSS

Note: Project Bidding Points give your group an edge over other groups for priority in choosing projects

uf-directory-app-assignment's People

Contributors

cgardnermccune avatar harrygogonis avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

uf-directory-app-assignment's Issues

Assignment1 branch vs assignment1 branch

It appears that the assignment1 branch exists only to provide students a link to viewing the Assignment1 branch. Shouldn't our repo and whatever canvas link just point to the Assignment1 branch by default? It's confusing to to have two branches with same name but different case.

Phelps Memorial Hospital Center is not a listing

for Assignment3, we are told:
/*
Phelps Memorial Hospital Center's address is incorrect. Find the listing, update it, and then
log the updated document to the console.
*/

and the only thing in the listings.json file with "Phelps" is "Phelps Laboratory"

I will be using "Phelps Laboratory" for the queries.js updatePhelpsMemorial function, unless told otherwise.

Test for 404 error checks that body is 'Bad gateway error'

Shouldn't a 404 error be "File not found" or "404 not found" while 502 is bad gateway?

Also I didn't see it mentioned that the page should output 'Bad gateway error' elsewhere other than the test requiring it. So if may have to be added unless I'm missing something.

Affected File: server.test.js
Line numbers: 65-66

        response.statusCode.should.be.exactly(404);
        body.should.be.exactly('Bad gateway error');

Maybe fixed

        response.statusCode.should.be.exactly(404);
        body.should.be.exactly('File not found');

Mocha test returning 'ECONNREFUSED'

I have manually tested my server.js file via console output to make sure it returns the correct outputs and statuses. Everything looks good.

When I use mocha to test, I receive the following:

λ mocha server.test.js

UF Directory Server Unit Tests
    Server responds to requests
      1) should respond
    Server provides listing data as JSON on proper request
      2) responds correctly to a GET request to "/listings"
      3) responds with a 404 error to other GET requests


  0 passing (3s)
  3 failing

  1) UF Directory Server Unit Tests Server responds to requests should respond:
     Uncaught AssertionError: expected Error {
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  message: 'connect ECONNREFUSED'
} to not exist
      at Request._callback (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\server.test.js:44:20)
      at self.callback (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\node_modules\request\request.js:198:22)
      at Request.onRequestError (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\node_modules\request\request.js:820:8)
      at Socket.socketErrorListener (_http_client.js:271:9)
      at net.js:459:14

  2) UF Directory Server Unit Tests Server provides listing data as JSON on proper request responds correctly to a GET request to "/listings":
     Uncaught AssertionError: expected Error {
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  message: 'connect ECONNREFUSED'
} to not exist
      at Request._callback (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\server.test.js:54:20)
      at self.callback (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\node_modules\request\request.js:198:22)
      at Request.onRequestError (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\node_modules\request\request.js:820:8)
      at Socket.socketErrorListener (_http_client.js:271:9)
      at net.js:459:14

  3) UF Directory Server Unit Tests Server provides listing data as JSON on proper request responds with a 404 error to other GET requests:
     Uncaught TypeError: Cannot read property 'statusCode' of undefined
      at Request._callback (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\server.test.js:65:17)
      at self.callback (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\node_modules\request\request.js:198:22)
      at Request.onRequestError (C:\Users\Matt\Documents\GitHub\UF-Directory-App-Assignment\node_modules\request\request.js:820:8)
      at Socket.socketErrorListener (_http_client.js:271:9)
      at net.js:459:14

The first and second error are due to some connection issue it seems, so it cant check for the status in the responses. The third error is probably similar - because it isn't receiving a response, it cannot check for the statusCode property.

I am using Node v0.12.2 and npm v2.7.4.

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.