npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

olist-anuncios

v1.0.2

Published

Api de Anuncios

Downloads

9

Readme

Olist API v0.0.1

Resumo

Está api fornece uma interface para manutenção de anúncios, no formato RESTful, como backend foi utilizado o Expressjs. Está API fornece os 4 métodos HTTP: GET, POST, DELETE e UPDATE

API valida todos os dados enviados antes de persistir na base.

Base de dados usado é MySQL

Instalação

Criação da Base de dados

Executar o seguinte script SQL em uma base de dados previamente selecionada:

    CREATE TABLE IF NOT EXISTS `anuncios` (
        `id` INT(11) NOT NULL AUTO_INCREMENT,
        `categoria` ENUM('produto','serviço') NOT NULL,
        `titulo` VARCHAR(60) NOT NULL,
        `descricao` TEXT NOT NULL,
        `estoque` INT(11) NOT NULL DEFAULT 0,
        `preco` DECIMAL(10,2) NOT NULL,
        `embalagem_largura` FLOAT(11) NULL DEFAULT NULL,
        `embalagem_altura` FLOAT(11) NULL DEFAULT NULL,
        `embalagem_profundidade` FLOAT(11) NULL DEFAULT NULL,
        `embalagem_peso` FLOAT(11) NULL DEFAULT NULL,
        `status` TINYINT(1) NOT NULL DEFAULT 0,
        `vendedor_nome` VARCHAR(40) NOT NULL,
        `vendedor_telefone` VARCHAR(15) NOT NULL,
        `vendedor_email` VARCHAR(100) NOT NULL,
        PRIMARY KEY (`id`))
        ENGINE = InnoDB
        DEFAULT CHARACTER SET = utf8
        COLLATE = utf8_general_ci;

Configurações

Antes de executar a aplicação, é necessário realizar algumas configurações. Abra o arquivo:

config/default.yaml

E configure a porta e os dados para conexão na base.

Exemplo:

    server: 9000
    database:
        client: 'mysql'
        host: 'localhost'
        user: 'root'
        password: '*****'
        database: 'database'

Mais detalhes sobre o sistema de configuração consulte: https://github.com/lorenwest/node-config

API

Refêrencia

| Endpoint | Descrição | | ---- | --------------- | | GET /api/:id | Recupera um anúncio pelo id fornecido | | POST /api/ | Cadastra um anúncio | | PUT /api/:id | Atualiza anúncio pelo id fornecido, | | DELETE /api/:id | Remove um anúncio |

Formato

Os dados devem ser enviado no formato JSON e serão entregue no formato JSON.

Validação

Caso ocorra erro de validação, um json de erro será retornado :

Exemplo:

    {
        error: true,
        errors: [
            'Título Obrigatório',
            'Descrição Obrigatório',
            'Embalagem Altura deve ser decimal',
            'Embalagem Profundidade deve ser decimal',
            'Embalagem Peso deve ser decimal',
            'Status deve ser valor Booleano',
            'Telefone do vendedor inválido',
            'E-mail do vendedor inválido',
            'Nome do vendedor Obrigatório',
            'Telefone do vendedor Obrigatório',
            'E-mail do vendedor Obrigatório',
            'Título deve ter no máximo 60 letras',
            'Categoria deve ser produto ou serviço',
            'Estoque deve ser inteiro',
            'Preço deve ser decimal',
            'Embalagem Largura deve ser decimal'
        ]
    }

Autor

André Timermann E-mail: [email protected] - 2015

Nota: Aplicação desenvolvida para fins de avaliação, não deve ser usada em ambiente de produção.