Giter VIP home page Giter VIP logo

nlwvaloiza's Introduction

Logo


NextLevelWeek 6.0

🙇🏻‍♂️ O que é a Next Level Week?

A NLW ou Next Level Week, é um evento online, totalmente gratuito, oferecido pela Rocketseat, que consiste, em uma semana com muito conteúdo prático, cheios de desafios e com um projeto que nos ajudará a avançar e atingir o próximo nível.

Rocketseat 🚀

🌍 Dias

  • Dia 1: Liftoff 20/06 ✔️
  • Dia 2: Maximum Speed 21/06 ✔️
  • Dia 3: In Orbit 22/06 ✔️
  • Dia 4: Landing 23/06 ✔️
  • Dia 5: Surface Exploration 24/06 ✔️

💻 Projeto - NLW Valoriza

NLW Valozira, é uma API desenvolvida com NodeJS, com o objetivo de conectar e valorizar as pessoas através de elogios.

⛏️ Tecnologias

  • Node JS
  • Typescript
  • Express
  • Typeorm
  • express-async-errors
  • reflect-metadata
  • class-transformer
  • PostgreSql
  • bcryptjs
  • JWT
  • uuid
  • cors
  • dotenv

💻 Como Executar

# Clone
$ git clone https://github.com/jocimarjsc/nlwValoiza.git

# Install Dependencies 
$ cd NLW-Together && yarn install

# Rename file ".env.example" to ".env"
$ mv .env.example .env

# Instale o banco PostgreSql e configure um banco de dados, mude todo o conteúdo de ormconfig.json utilizando o techo de código abaixo.
{
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "username": "usuário do seu banco",
    "password": "senha do seu banco",
    "database": "nome do seu banco",
    "entities": [
       "src/entities/**.ts"
    ],
    "migrations": [
       "src/database/migrations/**.ts"
    ],
    "cli": {
       "migrationsDir": "src/database/migrations",
       "entitiesDir": "src/entities"
    }
 }

# Execute
$ yarn dev

🔥 Como Utilizar

Abaixo é exibido a forma de utilização da API.

/*
* Add a new User
* @Route("http://localhost:3333/users, method={"POST"}")
*/
fetch(url, {
    method: 'POST',
    body: JSON.stringify({
      name: "Admin",
      email: "[email protected]",
      password: "admin",
      admin: true // true or false
	}),
    headers: {
    	"Content-type": "application/json; charset=UTF-8"
    }
})
/*
* Create a session to receive a token
* @Route("http://localhost:3333/login, method={"POST"}")
*/
fetch(url, {
    method: 'POST',
    body: JSON.stringify({
      email: "[email protected]",
      password: "admin"
	}),
    headers: {
    	"Content-type": "application/json; charset=UTF-8"
    }
})
/*
* List Tags
* @Route("http://localhost:3333/tags, method={"GET"}")
*/
fetch(url, {
    method: 'GET',
    headers: {
        "Content-type" : "application/json",
        "Authorization" : "Bearer {token}"
    }
})
/*
* Add a new tag if you are an administrator
* @Route("http://localhost:3333/tags, method={"POST"}")
*/
fetch(url, {
    method: 'POST',
    body: JSON.stringify({
        name: "Inspiration"
    }),
    headers: {
        "Content-type": "application/json; charset=UTF-8",
        "Authorization" : "Baerer {token}"
    }
})
/*
* List Users
* @Route("http://localhost:3333/users, method={"GET"}")
*/
fetch(url, {
    method: 'GET',
    headers: {
        "Content-type": "application/json; charset=UTF-8",
        "Authorization" : "Baerer {token}"
    }
})
/*
* Add a new compliment
* @Route("http://localhost:3333/compliment, method={"POST"}")
*/
fetch(url, {
    method: 'POST',
    body: JSON.stringify({
        tag_id: "{tag_id}",
        user_receiver: "{receiver_user_id}",
        message: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
    }),
    headers: {
        "Content-type": "application/json; charset=UTF-8",
        "Authorization" : "Baerer {token}"
    }
})
/*
* List of compliments sent by user
* @Route("http://localhost:3333/users/compliments/send, method={"GET"}")
*/
fetch(url, {
    method: 'GET',
    headers: {
        "Content-type": "application/json; charset=UTF-8",
        "Authorization" : "Baerer {token}"
    }
})
/*
* List of compliments received 
* @Route("http://localhost:3333/users/compliments/receive, method={"GET"}")
*/
fetch(url, {
    method: 'GET',
    headers: {
        "Content-type": "application/json; charset=UTF-8",
        "Authorization" : "Baerer {token}"
    }
})

Feito por Jocimar Costa 😊

nlwvaloiza's People

Contributors

jocimarjsc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.