Monday, 24 April 2017

NodeJs: run my app in webpage

I am new at nodejs so i dont really know how to make this work.

I have code which creates json output when i run node app.js from my console.

now i want to have the same json output in my website

so if someone enter example.com:8000 it will run the node app.js

My code is:

'use strict';

var pa11y = require();

// Create a test instance with some default options
var test = pa11y({

    // Log what's happening to the console
    log: {
        debug: console.log.bind(console),
        error: console.error.bind(console),
        info: console.log.bind(console)
    }

});

test.run('example.com', function(error, result) {
    if (error) {
        return console.error(error.message);
    }

    console.log(JSON.stringify(result));
});

Another question is:

What i need to change to get attribute from url and replace it in the code where example.com is.

Thanks



via user2413244

No comments:

Post a Comment