-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
45 lines (34 loc) · 1.14 KB
/
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
37
38
39
40
41
42
43
44
45
const { ApolloServer } = require('apollo-server');
const { makeExecutableSchema } = require('@graphql-tools/schema');
const mongoose = require('mongoose');
require('dotenv').config()
const {merge} = require('lodash')
const productoTypeDefs = require('./types/producto.types');
const productoResolvers = require('./resolvers/producto.resolvers');
const detalleVentaTypeDefs = require('./types/detalleVenta.types');
const detalleVentaResolvers = require('./resolvers/detalleVenta.resolvers');
const ventaTypeDefs = require('./types/venta.types');
const ventaResolvers = require('./resolvers/venta.resolvers');
const typeDefs = `
type Alert {
message: String
}
type Query {
_ : Boolean
}
type Mutation {
_ : Boolean
}
`;
// resolvers
const resolver = {}
const schema = new makeExecutableSchema({
typeDefs: [typeDefs, ventaTypeDefs, productoTypeDefs, detalleVentaTypeDefs],
resolvers: merge(resolver, ventaResolvers, productoResolvers, detalleVentaResolvers)
});
const server = new ApolloServer({
schema: schema
});
server.listen().then(({url})=> {
console.log(`Servidor Iniciado en ${url}`)
});