first commit
This commit is contained in:
26
index.js
Normal file
26
index.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const express = require("express")
|
||||
, expressLogging = require("express-logging")
|
||||
, logger = require("logops")
|
||||
, hostname = require('os').hostname()
|
||||
, browser = require('./HeadlessBrowser')
|
||||
, port = 32023;
|
||||
|
||||
|
||||
logger.getContext = function getContext() {
|
||||
return {
|
||||
// hostname: hostname,
|
||||
// pid: process.pid,
|
||||
port: port,
|
||||
app: 'Headless'
|
||||
};
|
||||
}
|
||||
var app = express();
|
||||
app.use(express.json());
|
||||
app.use(expressLogging(logger));
|
||||
app.listen(port, () => {
|
||||
logger.info({ app: 'Headless browser' }, 'Startup');
|
||||
});
|
||||
|
||||
app.post('/', async (req, res, next) => {
|
||||
browser.real(req.body.url).then(html => res.send(html))
|
||||
})
|
||||
Reference in New Issue
Block a user