You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
804 B
TypeScript

import { ApolloServer } from 'apollo-server'
import bikeresolver from './resolvers/cargobikeResolver'
import { CargoBikeAPI } from './datasources/db/cargobikeAPI'
import typeDefs from './schema/type-defs'
import 'reflect-metadata'
import { createConnection } from 'typeorm'
import { UserServerAPI } from './datasources/userserver/userserviceAPI'
require('dotenv').config()
createConnection().then(async () => {
console.log('connected to db')
}).catch(error => console.log(error))
4 years ago
const server = new ApolloServer({
resolvers: [bikeresolver],
typeDefs,
dataSources: () => ({
cargoBikeAPI: new CargoBikeAPI(),
userAPI: new UserServerAPI(process.env.RPC_HOST)
})
})
4 years ago
console.log(__dirname)
4 years ago
server.listen()
.then(({ url }) => console.log(`Server ready at ${url} `))