GithubHelp home page GithubHelp logo

node_mongo_pdf's Introduction

Generate a PDF file from MongoDB using NodeJS

(EN)

The purpose of this code is to return data from MongoDB in PDF format. The dependencies used in the project are express, mongoose, nodemon (optional) and html-pdf-phantomjs-included.
Requirements
NodeJS 16 or higher;
Docker and Docker Compose;
Postman, or any API Tester of your choice.
Usage
Clone this repository and run the npm install command. Then mount the MongoDB container with the command docker-compose build and start it with the command docker-compose up
start the NodeJS application with the npm start command.
This example is applied to PC video cards. Using Postman, connect to the URL localhost:3000/ and send a POST request with the following JSON structure:
{
   "name": "video_card_name",
   "memorySize": XXXX,
   "manufacturer":"manufacturer's_name"
}

Then, using Postman or a web browser, send a GET request to the URL localhost:3000/. A PDF will be displayed, or downloaded.
To use in your own applications, don't forget to modify the template.ejs file as well.

(PT)

O objetivo desse código é retornar dados do MongoDB no formato PDF. As dependências usadas no projeto são express, mongoose, nodemon (opcional) e html-pdf-phantomjs-included.

Requisitos
NodeJS 16 ou superior;
Docker e Docker Compose;
Postman, ou qualquer API Tester de sua preferência.

Modo de uso
Clone esse repositório e rode o comando npm install. Em seguida, monte o conteiner do MongoDB com o comando docker-compose build e o inicie com o comando docker-compose up
. Inicie a aplicação NodeJS com o comando npm start.
Esse exemplo está aplicado para placas de video de PC. Utilizando o Postman, conecte na URL localhost:3000/ e mande uma requisição POST com a seguinte estrutura JSON:
{
   "name": "nome_da_placa",
   "memorySize": XXXX,
   "manufacturer":"nome_do_fabricante"
}
Em seguida, utilizando o Postman ou o navegador web, mande uma requisição GET para a URL localhost:3000/. Um PDF será exibido, ou baixado.
Para usar em suas aplicações, não esqueça de modificar também o arquivo template.ejs.

node_mongo_pdf's People

Contributors

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