Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

71 Commits

Folders and files

Repository files navigation

ChatEz-Backend

Intro to Node.js Express and insomnia: https://www.youtube.com/watch?v=-MTSQjw5DrM

Developer setup:

Running:

  • (first time) npm install
  • Start local server
    • Linux: NODE_ENV=dev nodemon .
    • Windows: $env:NODE_ENV="dev"; nodemon .
    • if nodemon does not work use sudo npm install -g --force nodemon
  • Stop local server with Ctrl+C
  • Force stop local server: sudo kill -9 $(lsof -ti :8080)

Testing:

  • NODE_ENV=test npm test -- --maxWorkers=1 --timeout=10000
    • can only have 1 worker as accessing db and cannot do asynchronous changes
    • poor connection or machine in power saving mode can timeout tests and fail to fix:
      • provide a better environment for tests to run in
      • or increase test timeout parameters in command and in code

Notes:

  • Running in "dev"
    • uses development database
    • if you want your own database change MONGO_DB=ChatEz-Development in .env.dev to a name of your choice
  • Running in "test"
    • uses test database (for destructive testing)
    • disables auth and lastActive middleware, needed when doing npm test

Features:

  • getUser

  • setLanguage

  • setDisplayName

  • setProfilePhoto

  • addFriend

  • removeFriend

  • friendList

  • sendMessage

  • getMessages

  • getMessagesForSideBar

  • getUserMessages

  • setMessagesReadImplicitly

  • deleteConversation

  • deleteAllConversations

  • deleteUser

  • implicit last active based on any requests as auth user

  • implicit user creation on first auth user req

  • custom middleware for implicit requesting user from auth code

  • custom req logger middleware

  • custom auth enforcement middleware

  • implicit gcloud user from gcloud CLI

  • load secrets from google secret manager

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages