Expose express library to end users?
See original GitHub issueI would like to serve my build/dist folder for my static assets when developing/deploying to now or any server. For that I need to install express again and use the static function from there. It would be great if graphql-yoga had this inbuilt for my static assets otherwise it would good enough to re-export the express library for public use.
This is what I’m doing now
import express from 'express';
server.express.use(express.static('dist'));
Something like this would be more easier,
import GraphQLYoga from 'graphql-yoga';
const { GraphQLServer, express } = GraphQLYoga;
const server = new GraphQLServer({ typeDefs, resolvers, options })
server.express.use(express.static('dist'));
else more like this,
const server = new GraphQLServer({ typeDefs, resolvers, options: {
static: 'dist',
}});
BTW Great library. I had the same amount of code throughout my projects. This unifies it and also the apollo-upload-server is a plus that too it got recently released too.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:17 (3 by maintainers)
Top Results From Across the Web
Expose express library to end users? · Issue #9 - GitHub
I would like to serve my build/dist folder for my static assets when developing/deploying to now or any server. For that I need...
Read more >Exposing your local Node.js app to the world | Pluralsight
Learn how to expose your Node.js app in Localtunnel.me, ngrok, Zeit's now using a Hello World Express app. See which service may better...
Read more >Express/Node introduction - Learn web development | MDN
A module is a JavaScript library/file that you can import into other code using Node's require() function. Express itself is a module, as...
Read more >Node.js and Express Tutorial: Building and Securing RESTful ...
TL;DR: In this article, you will learn how to develop RESTful APIs with Node.js, Express, and Auth0. You will start from scratch, scaffolding...
Read more >Session Management in Node.js using ExpressJS and ...
Setting up the session middleware · Import all the Node.js libraries that we explained earlier · Initialize the express app · Add the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@geminiyellow this worked for me
I know this issue is closed, but I felt like contributing a solution that worked for me.
Hey, @Urigo from The Guild here!
You might know us from projects such as graphql-code-generator, envelop or graphql-tools.
For a long time we thought that the Javascript ecosystem is still missing a lightweight cross-platform, but still highly customizable GraphQL Server.
In the past the awesome Prisma team took on that great challenge and now we are happy to announce that we are continuing them and just released GraphQL Yoga 2.0 - Build fast, extensible, and batteries-included (Subscriptions, Serverless, File uploads support) GraphQL APIs in Node.js 🚀
And regarding the issue here, Yoga is completely separated from the way you do HTTP, so you can easily use and expose anything to express but also use Yoga on many other environments and frameworks like Fastify, Cloudflare Workers, Lambdas and many more (you can find all of them in the docs)
We have been working a long time on version 2.0 and have been using it in our clients projects for a few months now and shared a couple of alpha cycles here. Thank you all for your feedback and suggestions, you made this release possible!
Please try Yoga out again, give us feedback and help us spread the word on the new release!