Skip to content

sample CI/CD project using Mongo, Express, Node, and an Angular front end for a blogging site

License

Notifications You must be signed in to change notification settings

gokemon/group-a

Repository files navigation

connector-node

Connector is a Medium.com clone.

Connector is a fully featured social blogging site including:

  • Authentication with JWT(JSON Web Token)
  • Profiles with images
  • Write/edit/read articles
  • Comments on articles
  • Ability to "favorite" articles
  • Ability to follow other users & have their articles show up in your feed

I am building it with an Angular front-end and a Nodejs back-end. This is the Node back-end version. I plan to keep the front-end & back-end codebase separated from each other and communicate through a RESTful API with full CRUD (Create Read Update Delete) operations.

Some of Connector's "user story" functionality includes creating an account, posting an article, and editing.

Node as my API, using Express for server logic and MongoDB for the database. So its set up as a MEN-stack.


Please check out the API Design Specs readme, which covers;

  • Authentication,
  • User Profiles,
  • Articles,
  • Comments,
  • Tags,
  • Lists.

Branches

Based on the API above, I think I should set-up my planned branches here.

  • 01-setup
  • 02-user-model
  • 03-auth-middleware *
  • 04-auth-routes
  • 05-profiles
  • 06-articles-crud
  • 07-favorites
  • 08-comments
  • 09-following
  • 10-tags
  • This is about as far as I think I can go in the first sprint.

nodemon app.js

Code Overview

Dependencies

  • expressjs - Server middleware for handling and routing HTTP requests
  • express-jwt - Middleware for validating JWTs for authentication
  • jsonwebtoken - For generating JWTs used by authentication
  • mongoose - For modeling and mapping MongoDB data to javascript
  • mongoose-unique-validator - For handling unique validation errors in Mongoose. Mongoose only handles validation at the document level, so a unique index across a collection will throw an exception at the driver level. The mongoose-unique-validator plugin helps us by formatting the error like a normal mongoose ValidationError.
  • passport - For handling user authentication
  • slug - For encoding titles into a URL-friendly format

Application Structure

  • server.js - Application entry point. This file defines the express server and connects it to MongoDB using mongoose. It also requires the routes and models I'm creating.
  • config/ - Folder containing configuration for passport as well as a central location for configuration/environment variables.
  • routes/ - Folder containing the route definitions for my API.
  • models/ - Folder containing the schema definitions for my Mongoose models.
  • connector-api - The Application Folder into which I plan to fold the routes and models into. The config folder stays outside of this.

Credits

Sites that have assisted me in my studies of this project

Books

  • Web Development with MongoDB and NodeJS
  • Express in Action, 2016 by Manning Publications
  • Express.js Blueprints, 2015

About

sample CI/CD project using Mongo, Express, Node, and an Angular front end for a blogging site

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published