-
-
Save mikaelkaron/d10ee3863a6f0773c5386b77abea77fa to your computer and use it in GitHub Desktop.
microcule-docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.* | |
!/.gitignore | |
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:boron | |
# Create app directory | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# Install app dependencies | |
COPY package.json /usr/src/app/ | |
RUN npm install | |
# Bundle app source | |
COPY . /usr/src/app | |
# Expose port | |
EXPOSE 3000 | |
EXPOSE 5858 | |
ENTRYPOINT ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var microcule = require('microcule'); | |
var plugins = microcule.plugins; | |
var app = require('express')(); | |
app.use(plugins.bodyParser()); | |
app.use("/request/hook", plugins.spawn({ | |
code: require("./request.hook"), | |
language: "javascript", | |
customTimeout: 2147483647 | |
})); | |
app.use("/scrape/hook", plugins.spawn({ | |
code: require("./scrape.hook"), | |
language: "javascript", | |
customTimeout: 2147483647 | |
})); | |
app.use("/scrape/middleware", require("./scrape.middleware")); | |
app.listen(3000, function () { | |
console.log('server started on port 3000'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "microcule-docker", | |
"version": "0.0.0", | |
"main": "index.js", | |
"scripts": { | |
"start": "node index.js", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "MIT", | |
"dependencies": { | |
"express": "^4.14.1", | |
"microcule": "^5.0.1", | |
"request-x-ray": "^0.1.4", | |
"x-ray": "^2.3.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (hook) { | |
require('request')({ | |
"url": "http://www.eventsinamerica.com/event-search-results.html", | |
"method": "post", | |
"qs": { | |
"ipp": 100000, | |
"show_old": "include", | |
"parent_industry": "technology" | |
} | |
}) | |
.pipe(hook.res); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (hook) { | |
var x = require('x-ray')(); | |
x.driver(require('request-x-ray')({ | |
"method": "post", | |
"qs": { | |
"ipp": 100000, | |
"show_old": "include", | |
"parent_industry": "technology" | |
} | |
})); | |
x("http://www.eventsinamerica.com/event-search-results.html", { | |
"title": "title", | |
"results": x("#present-events tr", [{ | |
"event": "a", | |
"url": "a@href" | |
}]) | |
}) | |
.stream() | |
.pipe(hook.res); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (req, res) { | |
var x = require('x-ray')(); | |
x.driver(require('request-x-ray')({ | |
"method": "post", | |
"qs": { | |
"ipp": 100000, | |
"show_old": "include", | |
"parent_industry": "technology" | |
} | |
})); | |
x("http://www.eventsinamerica.com/event-search-results.html", { | |
"title": "title", | |
"results": x("#present-events tr", [{ | |
"event": "a", | |
"url": "a@href" | |
}]) | |
}) | |
.stream() | |
.pipe(res); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment