Skip to content

This is a Node.js backend application created with Express. It has a REST API, uses JWT and MongoDB.

License

Notifications You must be signed in to change notification settings

leogomesdev/sunshine-backend

Repository files navigation

🌞 SUNSHINE (Backend)

See the application structure in the image below: System tiers

This is the Backend application. For the Frontend application, please go to https://github.com/leogomesdev/sunshine-frontend

📚 Description

This project provides APIs for the frontend application.

📲 Main technologies used

💡 Requirements

💻 For local usage:

🚀 Running

🐳 Using Docker

  • Install Docker Desktop
  • Clone both repositories: sunshine-frontend and sunshine-backend
  • Access the root folder for one of the projects
  • Run:
      docker-compose up
  • This command will create and run 3 containers:
    • db: a MongoDB local instance
    • api: the sunshine-backend project
    • app: the sunshine-frontend project

💻 Locally

  • Be sure to install the requirements

    • If you have nvm - Node Version Manager installed, you could just run nvm install and it will install the correct version of Node.js based on file .nvmrc
  • Create the .env file:

      cp -v .env.example .env
  • Edit the .env file to provide the required environment variables.

  • Install dependencies:

      npm install
  • Start the application:

      npm run start

🔗 Usage (Backend)

🔎 Check the API documentation available at swagger (OpenAPI 3.0)

  1. Using Postman, go to the menu Files > Import and import the file Sunshine.postman_collection.json, available in the docs folder
  • After importing, the API Collection will be available on the left: Postman API Collection
  • The baseUrl variable is already defined on the Variables tab
  1. It is possible to use MongoDB Compass to check the data on the sunshine database, on users collection.
  • In the example below, the connection string is the required address when running this project with docker-compose:
    mongodb://localhost:27018/sunshine
    
    Using MongoDB Compass

✅ Tests

  # unit tests
  npm run test

About

This is a Node.js backend application created with Express. It has a REST API, uses JWT and MongoDB.

Topics

Resources

License

Stars

Watchers

Forks