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

38 lines
975 B

require("dotenv").config()
import { ApolloServer } from "apollo-server"
import { createConnection } from "typeorm"
import { User } from "./modules/User"
import { createSchema } from "./utils/createSchema"
const PORT = process.env.PORT || 4000
async function bootstrap() {
await createConnection({
type: "postgres",
host: "localhost",
port: 5432,
database: "postgres",
username: "postgres",
password: "postgres",
// dropSchema: true,
entities: [User],
synchronize: true,
logging: false,
})
// ... Building schema here
const schema = await createSchema()
// Create the GraphQL server
const server = new ApolloServer({
schema,
playground: true,
})
// Start the server
const { url } = await server.listen(PORT)
console.log(`Server is running, GraphQL Playground available at ${url}`)
}
bootstrap()