I hereby claim:
- I am ilkereroglu on github.
- I am ilkereroglu (https://keybase.io/ilkereroglu) on keybase.
- I have a public key ASB65HaPtUnJ9-urvM0b57JYALAXlmVmW15c23BuqBnKbQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".
Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).
Let's dig in:
web: node app |
app.post('/selam', function (req, res, next) { | |
var userName = req.body.user_name; | |
var bot = { | |
text : userName + 'Ooo cahil bey hoşgeldiniz.' | |
}; | |
if (userName !== 'slackbot') { | |
return res.status(200).json(bot); | |
} else { | |
return res.status(200).end(); |
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var app = express(); | |
var port = process.env.PORT || 1666; | |
app.use(bodyParser.urlencoded({ extended: true })); | |
app.get('/', function (req, res) { | |
res.status(200).send('Çalışıyor...'); |
{ | |
"name": "ilberHocaBot", | |
"version": "0.0.1", | |
"description": "Node Server", | |
"main": "app.js", | |
"author": "İlker Eroğlu", | |
"license": "MIT", | |
"dependencies": { | |
"express": "^4.x.x", | |
"body-parser": "^1.x.x", |