Git Product home page Git Product logo

lab-angular-forum's Introduction

Ironhack logo

Lab Angular 2 and Express | IronForum

Introduction

An Internet forum is a discussion area on a website. Website members can post discussions and read and respond to posts by other forum members. A forum can be focused on almost any subject and a sense of an online community, or virtual community, tends to develop among forum members.

Forums are a great mode of communication that first emerged in the late 70s and gained popularity throughout the 90s with the internet revolution.

Forums are typically organized in a tree-like structure, often beginning with categories such as "Technology", "Art", and "Random". These subcategories contain threads, or top level posts created by users.

Finally, these threads contain posts, replies made to a thread.

Forums often contain specific privileges and authentication logic. For instance, a User may have to be signed in to create posts. Logged out users may be able to browse posts, but not create them, and administrators can edit or delete posts.

Today, we'll create a simple forum with threads and replies. We'll skip out on the categories for this exercise to simplify the logic.

Requirements

  • Fork this repo
  • Clone this repo into your ~/code/labs
  • Include both the client and server applications in your submission.

Submission

  • Upon completion, run the following commands
git add .
git commit -m "done"
git push origin master

Exercise

Introduction

We've provided starter code with a an API for threads and posts. Currently, all requests are unauthenticated. Your task will be to write the front end of the forum in Angular 2, and authenticate the API.

Authentication routes can be found at the following locations, all of which are POST requests:

  • /api/login - Log the user in
  • /api/logout - Log the user out
  • /api/loggedin - Returns a user object with a status of 200 if the request is authenticated, and null with a status of 403 if not
  • /api/signup - Creates a new user. Returns the user object if successful, returns an error otherwise.

Iteration 1 | Display All Threads

In your Angular 2 app, create a service to make a GET request to /api/threads.

Using this service, create a component mounted at the home route with the angular router which will display all of the threads.

The home page should display a thread's title, author, and date.

Iteration 2 | Authentication

Add authentication to the forum app. On the home page, add a link to login or register. This should be done through Angular communicating with the Express API.

Iteration 3 | New Thread

On the home page, create a link to /threads/new. This link should only be displayed if a user is authenticated.

In the router, mount a new-thread-component, which will display a form to create a new thread.

This form should make a POST request to /api/threads with a title and content in the body.

Upon success, redirect the user back to the home page.

Iteration 4 | Single Thread Page

Add a method to your threads service to retrieve one thread by its id from the API.

Create a component mounted at /threads/:id, which will display a single thread, with its title, content, and the creator.

Create a link on the homepage for each of the threads to link to the single thread component.

Iteration 5 | Replies

In the single thread details component, create a form to add a reply. This form should only be visible if a user is logged in.

This form should make a POST request to /apis/threads/:id/replies with a content in the request body.

In the single thread details component, the user should be able to see all the replies to the thread.

lab-angular-forum's People

Contributors

jalexy12 avatar nizaroni avatar papuarza avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.