import { ApolloServer } from "apollo-server" ; import program from "commander" ; import resolvers from "./resolvers" ; import typeDefs from "./schema" ; import { sequelize } from "./models" ; program . option ( "-s, --sync-db" , "Sync database" ) . parse ( process . argv ) ; const run = ( ) => { if ( program . syncDb ) { sequelize . sync ( { force : true } ) ; } else { const server = new ApolloServer ( { typeDefs , resolvers } ) ; server . listen ( process . env . PORT || 4000 ) . then ( ( { url } ) => { console . log ( `🚀  Server ready at ${ url }` ) ; } ) ; } } ; run ( ) ;