-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (30 loc) · 1005 Bytes
/
index.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
37
38
39
// Call ApolloServer and startStandaloneServer
import { ApolloServer } from '@apollo/server';
import { startStandaloneServer } from '@apollo/server/standalone';
// Connection to MongoDB
import mongoose from "mongoose";
mongoose.connect('mongodb://localhost:27017/', {dbName: 'Northwind'})
.then(r => console.log('Connected to MongoDB'));
// Load models
import './models/mdl_Categories.js';
import './models/mdl_Products.js';
import './models/mdl_Suppliers.js';
import './models/mdl_Customers.js';
import './models/mdl_Employees.js';
import './models/mdl_Orders.js';
import './models/mdl_Shippers.js';
// Load data resources
import { typeDefs } from './data/schema_db.js';
// Mongo DB
import { resolvers } from './data/resolversMongo.js';
// Apolo Server
//import { resolvers } from './data/resolvers.js';
// Publish data resources
const server = new ApolloServer({
typeDefs,
resolvers
},);
// Run Apollo Server
const {url} = await startStandaloneServer(server,{
listen: { port: 4005 }
});