Created
November 10, 2019 11:48
-
-
Save vinodchauhan7/653f342e41bbea328a662d057ea26ca5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "reflect-metadata"; | |
//import { createConnection } from "typeorm"; | |
import express from "express"; | |
//import { User } from "./entity/User"; | |
import { ApolloServer } from "apollo-server-express"; | |
import { Resolver, Query, buildSchema } from "type-graphql"; | |
@Resolver() | |
class Hello { | |
@Query(() => String) | |
async hello() { | |
return "Hello World"; | |
} | |
} | |
(async () => { | |
const app = express(); | |
const apolloServer = new ApolloServer({ | |
schema: await buildSchema({ | |
resolvers: [Hello] | |
}) | |
}); | |
apolloServer.applyMiddleware({ app }); | |
app.listen(4000, () => { | |
console.log("Express server started at localhost:4000"); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment