-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
36 lines (32 loc) · 802 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Koa from 'koa';
import Router from 'koa-router';
// import Redis from 'redis';
const koa = new Koa();
const app = new Router();
// const client = Redis.createClient();
// app.get('/:name', async (ctx) => {
// ctx.body = `Hello, ${ctx.params.name}!\n`;
// });
app.post('/PMO', async (ctx) => {
ctx.body = 'hello';
//update Redis with new PMO
//send to Cassandra for storage
})
app.post('/login', async (ctx) => {
ctx.body = 'hi';
//calc distance
//determine starting zone
//read current PMO for zone
//calc price
//post active rider in Redis
//reply with riderid, price, time
//post this event to Cassandra
})
//
// app.post('/accept', async (ctx) => {
// //save to Cassandra
// //send to Thomas
// //send to David
// })
koa.use(app.routes());
koa.listen(3000);