Skip to content

A side project on how to structure an express app with mocked db and cronjob

Notifications You must be signed in to change notification settings

mstfash/express-api-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Users Articles

A side project to test out clean code, express, building my own mock db

Features

  1. User registration/login system with Passport using Local Strategy with JWT token implementaion.
  2. Protected routes with authmiddleware that checks for JWT validation using expressJWT
  3. Mocked database, so no database is required.
  4. Auto generated fake data for users and users posts.
  5. Cron job that runs every minute (can be modified) to drop database and seed new data every 1 hour.

Routes

Auth

  1. POST /api/auth/register
  2. POST /api/auth/login
  3. GET (JWT Protected) /api/auth/me

Posts

  1. GET /api/posts
  2. GET /api/posts/1
  3. GET /api/posts/:authorId
  4. POST (JWT Protected) /api/posts/add
  5. PUT (JWT Protected) /api/posts/1
  6. DELETE (JWT Protected) /api/posts/1

To run in development mode

npm start

To build

npm run build

About

A side project on how to structure an express app with mocked db and cronjob

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published