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

@rabelsan/nodepop-avanzado

v0.0.1

Published

<h1 align="center">Welcome to Nodepop: the tiny Wallapop 👋</h1> <p> <a href="https://github.com/rabelsan/nodepop-avanzado" target="_blank"> <img alt="Version" src="https://img.shields.io/npm/v/@rabelsan/nodepop-avanzado.svg"> </a> </p>

Downloads

2

Readme

Install

npm install @rabelsan/nodepop-avanzado && pm2 reload ecosystem.config.js --env production

Configure environment variables

Copy .env.example to .env and review the settings.

cp .env.example .env

Load initial data

You can load the database with initial data with:

npm run init-db

Warning! this script delete database contents before the load.

Use in production only in the first deployment.

Usage

npm start

Development start

npm run dev

API Methods

Authentication

POST /api/authenticate {body: email:"[email protected]", password: "xxxx"}

If the user credentials (email & password), are correct, it will return a valid JWT Otherwise it will return an error

HTTP/1.1 200 OK { "tokenJWT": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJfaWQiOiI1ZjlkYTk4MzNlMzAyMTMzNTZkOTdlMjEiLCJpYXQiOjE2MDQ1MTU3NjIsImV4cCI6MTYwNDUxNTc2N30. YPoZWhnZxm1R3SK5Ei_xFB9_eXA073nYL-cBZfO4lrE" }

List of advertisements

GET /api/anuncios

JWT Authorization parameter required. Options:

GET /api/anuncios (body: {token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJfaWQiOiI1ZjlkYTk4MzNlMzAyMTMzNTZkOTdlMjEiLCJpYXQiOjE2MDQ1MTg2NTQsImV4cCI6MTYwNDY5MTQ1NH0. eoF7TvqS0Ray0ZOyC9T-EMuXpr0pXkAcLB3zu_fa3vk)

GET /api/aununcios (header: {key: "Authorization" value: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJfaWQiOiI1ZjlkYTk4MzNlMzAyMTMzNTZkOTdlMjEiLCJpYXQiOjE2MDQ1MTg2NTQsImV4cCI6MTYwNDY5MTQ1NH0. eoF7TvqS0Ray0ZOyC9T-EMuXpr0pXkAcLB3zu_fa3vk}

GET /api/anuncios (query string) api/authenticate?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. eyJfaWQiOiI1ZjlkYTk4MzNlMzAyMTMzNTZkOTdlMjEiLCJpYXQiOjE2MDQ1MTg2NTQsImV4cCI6MTYwNDY5MTQ1NH0. eoF7TvqS0Ray0ZOyC9T-EMuXpr0pXkAcLB3zu_fa3vk

HTTP/1.1 200 OK [ { "sale": true, "tags": [ "bicicletas", "bycicles", "trek", "madone" ], "_id": "5f5a6ae91be10bf7d4a1956a", "name": "Trek Madone SLR7", "price": 5800, "photo": "images/bike-trek-madone-SLR7.jpg" } ]

HTTP/1.1 401 Unauthorized { "error": "no token provided" }

HTTP/1.1 401 Unauthorized { "error": "jwt expired" }

Example filters:

  • http://localhost:3000/api/anuncios?price=20
  • http://localhost:3000/api/anuncios?price=-20
  • http://localhost:3000/api/anuncios?price=20-
  • http://localhost:3000/api/anuncios?price=20-1500
  • http://localhost:3000/api/anuncios?tag=bike
  • http://localhost:3000/api/anuncios?tag=bike%20trek
  • http://localhost:3000/api/anuncios?sale=true
  • http://localhost:3000/api/anuncios?price=-6000&tag=bike%20trek&sale=true
  • http://localhost:3000/api/anuncios?limit=2
  • http://localhost:3000/api/anuncios?skip=20&limit=10
  • http://localhost:3000/api/anuncios?sort=name
  • http://localhost:3000/api/anuncios?sort=name%20price
  • http://localhost:3000/api/anuncios?fields=name%20-_id (Only name filed excluding the _id)

Retrieves one advertisement

GET /api/anuncios/_id

{ "result": { "sale": false, "tags": [ "guantes", "globes", "bicicleta", "bycicle" ], "_id": "5f5a6ae91be10bf7d4a1956b", "name": "Guantes Bluegrass Manatee", "price": 12, "photo": "images/guantes-bluegrass-manatee.jpg", "__v": 0 }

Create advertisement

POST /api/anuncios/upload file: {'photo=../casco-Dexter-Proton-Negan.jpg'} body: { name: 'casco-Dexter-Proton-Negan', sale: 'true', price: '60', tags: [ 'casco', 'moto' ]}

{ "result": { "sale": true, "tags": [ "casco", "moto" ], "_id": "5f5b9b0df9d13e2d0907582c", "name": "casco-Dexter-Proton-Negan", "price": 60, "photo": "images/ad_27942a04-233f-428a-905a-a793d2c847d3_casco-Dexter-Proton-Negan.jpg", "__v": 0 } }

Update advertisement

PUT /api/anuncios/<_id> body: { name: "Casco NEGRO Dexter Proton Negan" }

{ "result": { "sale": true, "tags": [ "casco", "moto" ], "_id": "5f5b9b0df9d13e2d0907582c", "name": "Casco NEGRO Dexter Proton Negan", "price": 60, "photo": "images/ad_27942a04-233f-428a-905a-a793d2c847d3_casco-Dexter-Proton-Negan.jpg", "__v": 0 } }

Delete advertisement

DELETE /api/anuncios/<_id>

Returns: HTTPCode 200

How to start a local mongodb instance for development

./bin/mongod --dbpath ./data/db --directoryperdb

APIDOC (Requires to start the application first)

Author

👤 Ramón Beltrán

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator