Giter Club home page Giter Club logo

cotabox-fullstack-challenge-api's Introduction

COTABOX FULLSTACK CHALLENGE API

What is this API?

This project is part of an application called cotabox-fullstack-challenge, who is part of a practical test for a job opportunity. It works together with the front-end to perform actions over a MongoDB Database.

What can i do with that?

With only the API, you can perform HTTP requests to perform actions over the Database, like add ou remove contributors, or just get information. This API is complementary to the front-end, but works alone as well.

Demo

A demo for this project is available on Heroku

https://cotabox-fullstack-challenge.herokuapp.com/

How can i contribute (or just test it)?

If you want to contribute, feel free to Clone this repository.

To start using, you need an MongoDB up and running (I really recommend MongoDB Atlas). After this, follow these steps in the project directory:

In the env-sample file, put your MongoDB Connection String over the CONNECTION_STRING and change the file name to .env

Run yarn init or npm init

Run yarn dev to work with nodemon, or just yarn start or npm start to just run the node start

Open http://localhost:3333 to view it in the browser.

endpoint documentation and how request file works

If you have the VSCode REST Client extension, the file requests.http will present a button called Send request over every request on the file, just click there to send request inside the VSCode. But, if not, just copy the requests and the body (if needed) to your favorite REST Client, like Insomnia or Postman.

Follow this next endpoint documentation to understand the functionalities:

GET - /contributors:

This GET will return a json list with all the contributors of the project, with they first names, last names and contribution.

GET - /totalContribution:

This GET will return a json with the sum of all participants contribution.

POST - /addContributor:

This POST store a new participant on the database, and return it. If the participant already exists, this will return a JSON with an error property, indicating that this client already exists.

This POST needs the JSON body bellow:

{
	"firstName":"First Name",
	"lastName":"Last Name",
	"contribution":10
}

DELETE - /removeContributor:

This DELETE remove an participant of the database, and return the result of deletion. If the participant doesn't exist, this will return a JSON with an error property, indicating that this client doesn't exist.

This DELETE needs the JSON body bellow:

{
	"firstName":"First Name",
	"lastName":"Last Name"
}

GET - /reset (Just for test purposes):

Take care with this GET, this will wipe all data of the MongoDB Database.




Made with ❤️ and NodeJS by Lucas Augusto.

cotabox-fullstack-challenge-api's People

Contributors

noriskii avatar

Watchers

James Cloos avatar  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.