Git Product home page Git Product logo

rest-api's Introduction

API RESTful haciendo uso de Node, Express y MongoDB 2.6.10

Esta API se construyó haciendo uso del tutorial que se encuentra en el siguiente link: Link del tutorial.

Nota: El proyecto ha sido probado únicamente en Ubuntu 16.04.4 LTS

Requerimientos

Al momento de probar el proyecto se utilizaron las siguientes versiones:

  • Node 8.8.1
  • npm 6.0.0
  • MongoDB 2.6.10

Pasos para correr el proyecto

  • Se debe clonar el repositorio de git haciendo uso del siguiente comando:
git clone [email protected]:alejandra21/rest-api.git
  • Instalar MongoDB 2.6.10 (en Ubuntu)
sudo apt-get install mongodb
  • Nos movemos al directorio rest-api:
cd rest-api
  • Luego se deben instalar las dependencias del proyecto
npm install
  • Finalmente, se debe correr el servidor haciendo uso del comando presentado a continuación:
node server.js

El API responder bajo los siguientes endpoints

Para agregar un nuevo elemento en la base de datos:

  • POST localhost:8080/exercises

Para listr todos los elementos de la base de datos:

  • GET localhost:8080/exercises

Para listar un elemeto en especifico de la basa de datos:

  • GET localhost:8080/exercises/:id

Para modificar un elemento especifico de la base de datos:

  • PUT localhost:8080/exercises

Para eliminar un elemento especifico de la base de datos:

  • DELETE localhost:8080/exercises/:id

Estructura de datos

{
    "name": "Prueba",
    "typeExercise": "exercise",
    "mainImage": "urlimagen.jpg",
    "levelDifficulty": 1,
    "creationDate": "2017-11-07",
    "timer": {
            "duration": 180
    },
            "lights": [
            {
                "colorCode": "300, 30, 1"
            }
        ],
        "music": [
            {
                "name": "name example",
	"sourcePath": "home/asd/asd.mp3",
	"volumen": 1
	}
	        ],
	        "videoTutor": [
	            {
	                "name": "",
	                "sourcePath": "home/asd/asd.mp4"
	}
	        ]
}	

Especificaciones para realizar PUT en el API

Es necesario incluir el id en el JSON que se le enviará al backend. Un ejemplo de esto se mostrará a continuación:

 
	{
	    "id": "5",
	    "name": "Prueba5",
	    "typeExercise": "test",
	    "mainImage": "ping.jpg",
	    "levelDifficulty": 10,
	    "creationDate": "2018-03-01",
	    "status": "disabled"
	}

rest-api's People

Watchers

 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.