Skip to content

ADA-Software-Engineering-Program/startup-plan-apiservice

Repository files navigation

Startup Plan

Startup plan is a SME/Bootstrapping platform that Provides customizable and user-friendly business plan templates, customer survey templates, competitive analysis and SWOT analysis templates that cater to the specific needs of startups

The product will help Startups:

  • 1.Access business plan templates.
  • 2.Access customer survey samples.
  • 3.Register businesses with appropriate institutions.
  • 4.Procure affordable legal and financial consultation.

Functional Requirements

  • 1.Shows the header and an overview of what to expect.
  • 2.Authentication whenever the user logs into the system.
  • 3.A verification email is sent to user whenever she registers for the first time.

System Features

  • 1.Landing Page.
  • 2.Signup/Login.
  • 3.Our services.
  • 4.Customer chat feature.
  • 5.Templates.
  • 6.Pricing and Subscription plan.
  • 7.Support and resources
  • 8.Testimonials and Reviews
  • 9.Social media links

Setting up the repository

This project was bootstrapped with NodeJs.

Getting started

To get the Node server running locally:

  • Clone this repo
  • npm install to install all required dependencies
  • Install MongoDB Community Edition (instructions) and run it by executing mongod
  • npm run dev to start the local server

Alternately, to quickly try out this repo in the cloud, you can Remix on Glitch

Code Overview

Dependencies

  • expressjs - The server 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

  • index.js - The entry point to our application. This file defines our express server and connects it to MongoDB using mongoose. It also requires the routes and models we'll be using in the application.
  • config/ - This folder contains configuration for passport as well as a central location for configuration/environment variables.
  • routes/ - This folder contains the route definitions for our API.
  • models/ - This folder contains the schema definitions for our Mongoose models.
  • controllers/ - This folder contains the controller definitions for our API.
  • @helpers/ - This folder contains the mongoBD configuration for our API and also Error handling.

Error Handling

In routes/api/index.js, we define a error-handling middleware for handling Mongoose's ValidationError. This middleware will respond with a 403 status code and format the response to have error messages the clients can understand

Authentication

Requests are authenticated using the Authorization header with a valid JWT. We define two express middlewares in routes/auth.js that can be used to authenticate requests. The required middleware configures the express-jwt middleware using our application's secret and will return a 401 status code if the request cannot be authenticated. The payload of the JWT can then be accessed from req.payload in the endpoint. The optional middleware configures the express-jwt in the same way as required, but will not return a 401 status code if the request cannot be authenticated.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published