Code Monkey home page Code Monkey logo

full-stack-overflow-developer-api's Introduction

Full Stack OverFlow Developer API 📚


About

In this API people can post and answer questions. You can register, view the answered and unanswered questions, send an answer and access a ranking with the users who have the most answer points.


Technologies

Tools that were used in the project:

For more see the package.json


How It Works

See sample requests and responses

  • See all unanswered questions here (GET /questions)

  • See the answers to a specific question here (GET /questions/QUESTION_ID), when not answered here

  • See the ranking by points here

  • To answer a question you need to create a user to get your authorization token:

Make a POST /users:

{
  "name": "Marcio",
  "class": "T3" 
}

It will return a json web token:

{
  "token": "xxxxx.yyyyy.zzzzz"
}

  • If you create a question with an uncreated user, it will also return an authentication token:

Make a POST /questions:

{
  "question": "Quando se deve usar 'var' no JavaScript?",
  "student": "João Pedro",
  "class": "T2",
  "tags": "javascript, var"
}

It will return the question id and user authentication token:

{
  "questionId": 2,
  "userToken": "xxxxx.yyyyy.zzzzz"
}

  • To answer a question:

Make a POST /questions:QUESTION_ID :

{
  "answer": "É um mecanismo de controle de fluxo que visa beneficiar processos assíncronos." 
}

It will return status code 200 created. Make sure you're sending a header in the format:

  BEARER xxxxx.yyyyy.zzzzz
  • To up vote a question (increase one point), make a PUT /questions/QUESTION_ID/up-vote

  • To down vote a question (decrease one point), make a PUT /questions/QUESTION_ID/down-vote


Getting Started

To run locally follow the steps

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
npm install npm@latest -g

Installation

  1. Create the root folder named full-stack-overflow-developer and access it
mkdir full-stack-overflow-developer && cd full-stack-overflow-developer
  1. Clone the repo
git clone https://github.com/cgabrieu/full-stack-overflow-developer-api.git
  1. Install dependencies with npm
npm install
  1. Create a database using the command below via postgres
CREATE DATABASE fullstackoverflow;
  1. Automatically create all necessary tables to backend repo with dump.

  2. Connect your backend to the database, for that, rename the .env.example to .env.dev and fill in your data.

How to run

  1. Run using the command (remember to be on the repo):
npm run start:dev

How to contribute

  1. Fork the project.
  2. Create a new branch with your changes: git checkout -b feat/myFeatureName
  3. For each feature implemented, make a commit specifying what was done
  4. Submit your changes: git push -u origin feat/myFeatureName

Developer

full-stack-overflow-developer-api's People

Contributors

cgabrieu 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.