Git Product home page Git Product logo

bks_api's Introduction

API de libros

Este proyecto esta hecho con graphql sobre el framework fastAPI

Instalación de dependencias

Ejecute el comando siguiente sobre el directorio raiz del proyecto para entorno linux

  1. crear un virtual environment
    python -m venv venv
  1. Activar el entorno
    source venv/bin/activate
  1. instalar las dependencias
    pip install -r requitements.txt

Ejecución

  1. ejecute el siguiente comando para levantar un servidor de uvicorn en su maquina.
    uvicorn main:app --reload

Probar aplicación

En el navegador ingresé a la siguiente dirección:

    http://localhost:8000/book

En esta dirección vera el entorno de ejecución de consultas de graphql en el cual puede realizar las siguientes operaciones:

  1. Crear un libro
mutation Ex {
  createBook(
		title: "El librote", 
		subtitle: "el libro mas grande",
		authors: "Ferchito, Fernando",
		categories: "ciencia ficción, Acción",
		editor: "me",
		description: "some description"
		image: "http://images.com.co/image1.png"
	)
  1. Listar todos los libros
query Ex {
	books
	{
		id,
		title,
		subtitle,
		authors,
		categories,
		editor,
		description,
		image
	}
}
  1. Traer un soo libro por su ID
query Ex {
	book(id: 1)
	{
		id,
		title,
		subtitle,
		authors,
		categories,
		editor,
		description,
		image
	}
}
  1. Actualizar la información de un libro
mutation Ex {
  updateBook(
		id: 1,
		title: "El librotote", 
		subtitle: "gran viaje",
		authors: "Fercho",
		categories: "ciencia ficción",
		editor: "me",
		description: "some description"
		image: "http://images.com.co/image1.png"
	)
}
  1. Eliminar un libro
mutation Ex {
  deleteBook(id: 1)
}
  1. Consultar un libro por un atributo especifico
query Ex {
  queryBook(field: "authors", value: "Ferchito"){
		id,
		title,
		subtitle,
		authors,
		categories,
		editor,
		description,
		image
	}
}
  1. Consultar libros por cualquiera de sus atributos
query Ex {
	findBook(value: "Harry") {
		title,
		subtitle,
		authors,
		categories,
		editor,
		description,
		image
	}
}

Existe un despliegue en linea en el siguiente enlace, pero solo permite las consultas de lectura

    https://bks_api-1-k1625606.deta.app/book

bks_api's People

Contributors

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