Nocturnal Prancing Mosquito

    gdom-node

    0.0.9 • Public • Published

    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
    

    Install

    npm i gdom-node

    DownloadsWeekly Downloads

    14

    Version

    0.0.9

    License

    ISC

    Last publish

    Collaborators

    • iamnoturkitty