kajlund / caching

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

x# Caching Server

Caching server is a REST API server for the cachecheats web app built on Express abd Knex.js using Postgres DB.

Testing

Testing is done using the Japa testing tool using its Assert plugin and Supertest for emulating http calls.

Architecture

  • Top layer is API route definitions and route handlers.
    • API/resource/routes.
    • Route handlers/controllers send back responses and status codes but do no actual business logic.
    • The BaseController class contains methods for handling normal CRUD.
  • Second layer is the service layer handling business logic and sending results or error back to calling controller
    • The BaseService class handles basic CRUD operations
    • Create a subclass for overriding validation functions and adding resource specific functionality
  • Third layer is the data-access layer handling actual DB queries
    • BaseRepository class handles shared CRUD functionality

Requirements

  • As an admin I want to be able to CRUD places and cachetypes
    • Add CRUD API for places and cachetypes
  • [] As a user i want to be able to register for an account so that I can use the application
    • Register endpoint for registering new user
  • [] As an admin I need to be able to promote users to enable them to use the system
    • Add admin promote endpoint
  • [] As a user I want to be able to log on so that I can use the system
    • Add logon endpoint
  • [] As a user, when I am loggen on, I want to see my profile information so I can verify that the system holds correct information
    • Add user profile endpoint
  • [] As a user I need to be able to reset my password if I have forgotten it
    • Add user pwd reset endpoint sending email with expiring link for reset
  • [] As a user I need to be able to list, filter, search add, update and archive caches that I have added.

Project outline

  • Basic setup
    • Create initial app file. Server, linting, formatting, dev script using nodemon, db connection, config and logger
    • Add launch file for VSCode debugging
    • Add security middleware
    • Setup testing tools
  • Add DB migration(s) and data seeders
    • DB migration for all known tables
    • Seeders for populating all
    • npm scripts for running migtations and seeding
    • Create postgres DB for dev and test
    • [] Production DB setup
  • Add REST API
    • Add crud endpoints for places
    • Refactor shared functionality to base classes
    • Refactor to separate app and web server
    • Refactor to create generic route handler class
    • Add data validators
    • Add CRUD endpoints for cachetypes
    • [] Add CRUD endpoints for users
    • [] Add authorization middleware
    • [] Add CRUD endpoints for caches and cachecomments
    • [] Add proper testing

About


Languages

Language:JavaScript 100.0%