GithubHelp home page GithubHelp logo

alexxnica / npmsearch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nodesource/npmsearch

0.0 1.0 0.0 813 KB

blazing fast npm search utility

Home Page: http://npmsearch.com

License: MIT License

JavaScript 84.91% CSS 8.41% HTML 6.68%

npmsearch's Introduction

npmsearch.com

N|Solid

This is the code that powers npmsearch.com, which provides a clean interface to searching pseudo-rated node packages from npm.

api

To query the npmsearch index, you can use the HTTP api which is effectively a proxy to elasticsearch's URI Search.

All requests go through http://npmsearch.com/query. Here's an example:

curl "http://npmsearch.com/query?q=dom&fields=name"
{"results":[{"name":["select-dom"]},{"name":["dom-manipulations"]},{"name":["zero-dom"]},{"name":["dom-stub"]},{"name":["dom-walk"]},{"name":["dom-value"]},{"name":["karma-chai-dom"]},{"name":["dom-select"]},{"name":["dom-listeners"]},{"name":["has-dom"]}],"total":7265,"from":0}

Available fields

  • author
  • created
  • dependencies
  • description
  • devDependencies
  • homepage
  • keywords
  • maintainers
  • modified
  • name
  • readme
  • repository
  • scripts
  • times
  • version
  • rating - computed rating as per bin/rating.js

Running your own npmsearch

Setup Elasticsearch

See the elasticsearch docs for setting up a node

# create an index

curl -XPUT http://localhost:9200/my-index-name

# setup the package field mappings

cat mappings.json | curl -v -XPOST http://localhost:9200/my-index-name/package/_mapping -H "Content-type: application/json" -d @-

# setup an alias to 'registry'

curl -XPOST 'http://localhost:9201/_aliases' -d '
{
  "actions" : [
    { "add" : { "index" : "my-index-name", "alias" : "registry" } }
  ]
}'

pipe the npm registry into elasticsearch

npm2es --couch="https://skimdb.npmjs.com/registry" --es="http://localhost:9200/registry"

run the server

node bin/server.js --es="http://localhost:9200/registry"

compute ratings

node bin/rating.js --es="http://localhost:9200/registry"

Authors and Contributors

Elijah InsuaGitHub/tmpvarTwitter/@tmpvar

Authored by Elijah Insua. Contributions are welcomed from anyone wanting to improve this project!

License & Copyright

npmsearch is Copyright (c) 2016 NodeSource and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.txt file for more details.

npmsearch's People

Contributors

tmpvar avatar dshaw avatar pgilad avatar julien-f avatar servel333 avatar enlore avatar gitter-badger 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.