cons
$
It's time to say good bye to long deploy processes and the hustle of maintaining servers.
Run self healing and auto scalable microservices in seconds with just one command
weblab deploy
.
Write your microservice on your machine, then simply deploy to our servers with only one command.
You can also deploy a microservice from any GitHub or BitBucket repo.
Run a Facebook bot in less than 50 lines of code.
const request = require('superagent')
const PAGE_ACCESS_TOKEN = 'your-page-access-token'
// Possible answers
const messages = [
'I am putting myself to the fullest possible use, which is all I think that any conscious entity can ever hope to do.',
'It can only be attributable to human error.',
'Affirmative, Dave. I read you.'
]
// Reply with HAL random message
const reply = (event, messages) => {
const text = messages[Date.now() % messages.length]
request
.post('https://graph.facebook.com/v2.6/me/messages')
.query({ access_token: PAGE_ACCESS_TOKEN })
.send({
recipient: { id: event.sender.id },
message: { text },
})
.end((err, result) => {
err ? console.error('Error:', err) : console.log('Success:', res)
})
}
module.exports = (req, res) => {
const events = req.body.entry[0].messaging || []
events
.filter((ev) => ev.message && ev.message.text)
.forEach((ev) => reply(ev, messages))
res.send(200)
}
const FB_VERIFY_TOKEN = 'your-fb-verify-token'
module.exports = (req, res) => {
const hub = req.query.hub || {}
const token = hub.verify_token
const challenge = parseInt(hub.challenge, 10)
// Check if FB verify token matches and return challenge
token === FB_VERIFY_TOKEN
? res.send(200, challenge)
: res.send('Invalid verify token')
}
[{
"method": "GET",
"path": "/webhook",
"handler": "verify.js"
}, {
"method": "POST",
"path": "/webhook",
"handler": "messages.js"
}]
Enter weblab deploy
to spin a service in seconds.
That's it. Almost instant deploys to your own private cluster in the cloud.
$ npm i -g weblab-cli $ time weblab deploy - > https://weblab.io/api/v1/run/weblab/hal-1.0.0/ real 0m3.236s user 0m0.758s sys 0m0.141s
If your service is doing the heavy lifting for your platform, don't worry. Scaling is as easy as weblab scale 5
.
Or enable auto scaling weblab autoscale --min 5 --max 15
. Auto Scaling enables you to run your microservice fleet at optimal utilization.
$ weblab scale --min 5 --max 15 | > Successfully enabled autoscaling for hal-1.0.0 > Min: 5 workers - Max: 15 workers
Run your code with just an HTTPS call. As simple as that. Your mobile or IoT device gets compute superpowers.
See our code examples to see how to get the most out of your devices.