title: Has Apollo Federation support code-first approach?
body: <p>I have <code>code-first</code> declarations on project. But I want to use them as microservices. In this case, how can i separate my <code>typeDefs</code> and <code>resolvers</code> according to Apollo's <code>schema-first</code> approach. Is it possible ?. I didn't find any resources that contain this approach in <code>graphql-js</code> and <code>apollo</code> docs. It would be great any advice ..</p>
  <p>In <code>Apollo</code> docs it described as (can be access <a href="https://www.apollographql.com/docs/federation/api/apollo-subgraph/" rel="nofollow noreferrer">here</a>):</p>
  <blockquote>
  <pre class="lang-js prettyprint-override"><code>const server = new ApolloServer({
    schema: buildSubgraphSchema([{ typeDefs, resolvers }])
  });
  </code></pre>
  </blockquote>
  <p><code>buildSubgraphSchema()</code> doesn't support schema as argument.</p>
  <p>Wanted approach:</p>
  <pre class="lang-js prettyprint-override"><code>const server = new ApolloServer({
    // Instead of schema-first style
    // schema : buildSubgraphSchema([{ typeDefs, resolvers }])
    // this:
    schema: buildSubgraphSchema([userSchema])
  });
  </code></pre>
  <h2>Take a look at the code :</h2>
  <p><code>userType.ts</code></p>
  <pre><code>const userType = new GraphQLObjectType({
    name: 'User',
    description: 'User Type Definition',
    fields: (): any =&gt; ({
      username: {
        type: new GraphQLNonNull(GraphQLString),
      },
      email: {
        type: GraphQLString,
      },
      phone: {
        type: GraphQLString,
      },
      firstName: {
        type: GraphQLString,
      },
      lastName: {
        type: GraphQLString,
      },
    }),
  });
  </code></pre>
  <p><code>userQueries.ts</code></p>
  <pre><code>const userQueries = {
    users: {
      type: new GraphQLList(userType),
      description: 'Return users',
      resolve: () =&gt; {
        return getUsers();
      },
    },
  };
  </code></pre>
  <p><code>query.ts</code></p>
  <pre><code>const query = new GraphQLObjectType({
    name: 'Query',
    description: 'Queries',
    fields: userQueries,
  });
  </code></pre>
  <p><code>schema.ts</code></p>
  <pre><code>const userSchema = new GraphQLSchema({
    query,
    types: [userType],
  });
  </code></pre>
  <p><code>server.ts</code></p>
  <pre><code>const server = new ApolloServer({ userSchema });
  server.listen(4000).then(({ url }) =&gt; {
    console.log('Running a GraphQL API server at localhost:4000/graphql');
  });
  </code></pre>