-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver-compiled.js
More file actions
86 lines (65 loc) · 2.24 KB
/
server-compiled.js
File metadata and controls
86 lines (65 loc) · 2.24 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
'use strict';
var _express = require('express');
var _express2 = _interopRequireDefault(_express);
var _testdebug = require('./data/testdebug');
var _testdebug2 = _interopRequireDefault(_testdebug);
var _expressGraphql = require('express-graphql');
var _expressGraphql2 = _interopRequireDefault(_expressGraphql);
var _mongodb = require('mongodb');
var _graphql = require('graphql');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//import schema from './data/schema';
var Schema = function Schema(db) {
var linkType = new _graphql.GraphQLObjectType({
name: 'Link',
fields: function fields() {
return {
_id: { type: _graphql.GraphQLString },
title: { type: _graphql.GraphQLString },
url: { type: _graphql.GraphQLString }
};
}
});
var schema = new _graphql.GraphQLSchema({
query: new _graphql.GraphQLObjectType({
name: 'Query',
fields: function fields() {
return {
links: {
type: new _graphql.GraphQLList(linkType),
resolve: function resolve() {
var inst = new _testdebug2.default();
inst.logFuncition('messagetext');
return db.collection("links").find({}).toArray();
}
}
};
}
})
});
function logger() {
"use strict";
console.log('joggu');
}
return schema;
};
var app = (0, _express2.default)();
app.use(_express2.default.static('public'));
var db = undefined;
_mongodb.MongoClient.connect('mongodb://ohabbers:dykk12@ds042898.mongolab.com:42898/dbgira', function (err, database) {
if (err) throw err;
db = database;
app.use('/graphql', (0, _expressGraphql2.default)({
schema: Schema(db),
graphiql: true
}));
app.listen(3000, function () {
return console.log('Listening on port 3000 ');
});
});
if (true) {
console.log('jaggu');
var inst = new _testdebug2.default();
inst.logFuncition('messagetext');
}
//# sourceMappingURL=server-compiled.js.map