adriel87 / tarot-dev-back

a simple backend service whit express and mongo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

๐Ÿ–ฅ๏ธ๐Ÿ”ฎ tarot-dev-back ๐Ÿ”ฎ๐Ÿ–ฅ๏ธ

Description

The principal function for this server is manage the SigIn/LogIn, provide service about tarot cards.

How to install

  1. Clone the repository after continue configure your variables take the .env.example and rename for .env. Then edit .env whit your enviroment variables

before you continue you need mongodb you can install manually in your computer or you can dockerize your mongodb

see the next steps

mongo ๐Ÿค–

first install docker

second create a container whit mongo image in the link explain how run a docker container in local

third, you can use docker compose file in repositorie just need type before you laun the server

yarn db-start

this function run a container whit mongo in dettached mode

cloudinary

if you test this repo in local you need have a account in cloudinar

once you are registered, go to dashboard and check the next values

  • cloud name
  • api Key
  • api secret

whit this you can change the next enviroment variables

CLOUDDINARY

CLOUD_NAME= your clod CLOUD_API_KEY= your api key CLOUD_SECRET= your api secret

  1. in the root of the project run a terminal and execute the next command:
yarn

set enviroment variables

  1. wake up the backend app
yarn start

if you have any problem please take a look to your enviroment variables, check your database is running.

Services

we have 3 principal services in this backen

  1. authenticate
  2. Tarot card Rest-Api
  3. upload images to cloudinary

Authentication

in the first iteration of tarot dev back we implement a basic auth

  1. create or autenthicate a user
  2. send a token for upcoming request
  3. validate all request whit the previous token sended

๐ŸŽด Tarot Cards ๐ŸŽด

in tarot card we have a usual crud but the application count whit another methods to manage the associate images of tarot cards

  • the middlewares
    • save image in server
    • upload to cloudinary, in this method we receive an url whit image direction
    • delete image in localhost

User ๐Ÿ™โ€โ™€๏ธ๐Ÿ™โ€โ™‚๏ธ

In this case we get different method to check some things about the user or update some fields

  • check by email
  • setVote
  • setUploadImage

Technology ๐Ÿ–ฅ

The core of the app is build in nodejs, but the project use some libraries like:

  • express, framework to create API-REST
  • mongodb, non relational DB
  • dotenv, manage our enviroment variables in a simple file
  • multer, manage incoming files,
  • jsonwebtoken and bcrypt to manage security

next steeps ๐Ÿฆถ

automate how reset the fields isVoted and isTarotCardSend in user implement Rest-API for tarot card puntuation

use free and share

made whit ๐Ÿ’œ by Adriel Arocha Oronoz

About

a simple backend service whit express and mongo

License:MIT License


Languages

Language:TypeScript 97.5%Language:Shell 1.3%Language:HTML 1.2%