atikahe / devcamper-api

Backend service for developer bootcamp directory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Devcamper API Backend

Create the backend for a bootcamp directory website. .

Usage

  1. Install dependency
npm i
  1. Setup mongo connection and others in src/config/config.env
PORT=5000
NODE_ENV=development
MONGO_URI=mongodb+srv://<username>:<password>@cluster0.eyab0.mongodb.net/<dbname>?retryWrites=true&w=majority
  1. Seed database
npm run seeder:import
  1. Run development mode
npm run dev
  1. Application is now available in port 5000

  2. On committing new code, use karma runner style message format.

git commit -m "type(<scope>): subject"

Geolocation Service

Setup geolocation provider and api key src/config/config.env

GEOCODER_PROVIDER=provider_name
GEOCODER_API_KEY=provider_api_key

Then configure the geocoder in src/utils/geocoder.js

const NodeGeocoder = require('node-geocoder');

const options = {
  provider: process.env.GEOCODER_PROVIDER,
  apiKey: process.env.GEOCODER_API_KEY,
  httpAdapter: 'http',
  formatter: null,
  ...otherSettingsHere
};

const geocoder = NodeGeocoder(options);

Documentation

Full documentation link will go here.

Linting and Formatting

In this project we are adopting airbnb standard (not there yet but we're heading!) enforced using eslint and prettier. Do not skip pre-commit hooks to run the formatting automatically against new code, or alternatively you can do as follows:

# For manual test
# Go to root folder of project
npm run lint
npm run prettier
# This will fix all linting issues
# PR is good to go

Development Phase and Progress

  • Phase 1 : Environment Setup
  • Phase 2 : Dependency Setup
  • Phase 3 : Server setup
    • Setup basic express server
    • Setup controller
    • Middleware setup
  • Phase 4 : Database setup
    • Setup MongoDB database
    • Configure Model for Bootcamp database
    • Basic CRUD functionality
  • Phase 5 : Middleware setup
    • Error handler middleware & custom ErrorResponse Class
    • Async/Await middleware
    • Use mongoose middleware
    • Slugify
    • Geolocation
  • Phase 6 : Mongoose advanced query
    • Bootcamps database seeder
    • Geospatial Query in Mongodb
    • Filtering & Sorting
    • Pagination
    • Controller & Routes for Courses
    • Database for Courses
    • Populate, virtuals, cascade & delete
    • Courses CRUD functionality
    • Aggregation (calculating average cost)
    • Photo upload
    • Advanced results middleware
  • Phase 7 : Authentication, User, & Permissions (1)
    • User model
    • User password encryption
    • Sign & Get JWT
    • User login & send token in cookie
    • Protect routes with middleware
    • Role authorization
  • Phase 7.1 : Inforce Code Quality (Should be configured at earlier phase! But it is what it is 😺)
    • Linter and code style setup
    • Unit test setup
    • Run tests in git hook
  • Phase 8 : Authentication, User, & Permissions (2)
  • Phase 9 : Bootcamp Reviews & Ratings
  • Phase 10 : API Security
  • Phase 11 : Documentation & Deploy

About

Backend service for developer bootcamp directory.


Languages

Language:JavaScript 100.0%