Code Monkey home page Code Monkey logo

angular-mean-course's Introduction

What it is

This was a project to learn the MEAN stack by creating a posting app. The MEAN stack is mongoDB, Express framework, angular, nodejs.

How it works

The routes are as follows:

"":

The main page which displays the post-list component, a list of the posts in the database. A post includes a title, content, and a locally uploaded image. The post-model.ts also includes an id and a creator.

"create":

The page used to create a post, including a title, content, and an image.

"edit/postId":

Upon click of a post's EDIT button, they are sent to this route displaying the post and the postId is appended to the URL so the user sees just the 1 post from the database, and can edit it. Upon submit of the edited post, the new values of the post are updated in the database with a PATCH method.

"auth":

auth is the precursor to the login and signup components and not an actual route itself. The login & signup are actually "auth/login" & "auth/signup", respectively. "auth" is used to import the route precursor into the regular routing module/ connect them to make the code more organized.

"login":

This page redirects to the login component, which displays a login screen where an existing user can login. The username cannot be the same as another user's, and the password must match to login. Once the user logs in, they have access to all posts but are only permitted to edit or delete posts they have created themselves with the account they are logged in with.

"signup":

The signup page is where a new account can be registered with the fields 'E-mail' & 'Password'.

How it looks

The user comes to the app page and in the first instance sees the list of existing posts in the database with the ability to choose how many posts they want to see per page:

A user can then choose to sign up, creating a new user:

Once the new user is created, they can navigate to the login page by clicking Login in the nav bar:

After the user has logged in, they come back to the first page of the app (all posts), except this time they are logged in. A user can then choose to create a post by clicking New Post in the nav bar. The user fills in the fields as requested, and when choosing an image a window pops up that lets the user choose a local image. When the user clicks 'Save Post', the post is saved to the database and becomes a part of the list of visible posts:

If a user has created a post, they will have the option to EDIT or DELETE that same post. A user may not delete or edit posts from other users.

If the user edits a post, the updated values will reflect in the changed post. If the user deletes a post, the post will disappear automatically from the view.

Backend

The api routes are manually programmed and include routes for creating a user and creating/editing/fetching/deleting a post. An authorization token is given and decoded for a login session. There are 2 collections in the database: posts & users.

Summary

This is just a simple posting app I made in order to learn the basics of the MEAN stack and how to create a RESTful API, connect it to the frontend server, etc.

angular-mean-course's People

Contributors

dependabot[bot] avatar

Watchers

 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.