0.0.9 • Published 10 years ago

gdom-node v0.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
10 years ago

gdom-node

Port of gdom for node.js. Based on axios & cheerio.

You can play with it online : DEMO

##Install

npm i -S gdom-node

##Usage Import parse function from gdom-node, then pass your query as argument, result of execution will be a promise:

// using an ES6 transpiler, like babel
import {parse} from "gdom-node"

// not using an ES6 transpiler
var parse = require("gdom-node").parse

let query = `{
  page(url:"http://news.ycombinator.com") {
    items: query(selector:"tr.athing") {
      rank: text(selector:"td span.rank")
      title: text(selector:"td.title a")
      sitebit: text(selector:"span.comhead a")
      url: attr(selector:"td.title a", name:"href")
      attrs: next {
         score: text(selector:"span.score")   
      }
    }
  }
}`

parse(query).then(function(result){
    //do something
})

You can also import graphQL Schema, if you need it:

import {Schema} from "gdom-node"

//or

var Schema = require("gdom-node").Schema

##Test

npm test
0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago