-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (30 loc) · 824 Bytes
/
index.js
File metadata and controls
35 lines (30 loc) · 824 Bytes
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
const seneca = require('seneca')();
const SenecaWeb = require('seneca-web');
const express = require('express');
const bodyParser = require('body-parser');
const expressAdapter = require('seneca-web-adapter-express');
const api = require('./plugins/api');
// const routes = require('./routes');
const port = 3000;
const app = express();
app.use(bodyParser.json());
seneca
// .use('mongo-store', {
// name: 'seneca',
// host: '127.0.0.1',
// port: '27017'
// })
.use(SenecaWeb, {
// routes,
context: app,
adapter: expressAdapter,
options: { parseBody: false }
})
.use(api)
.ready(err => {
if (err) throw err;
const server = seneca.export('web/context')();
server.listen(port, () => {
console.log(`Server is listening on http://localhost:${port}`);
});
});