-
-
Save jtoar/57f7c9a73d0207e064a37f92eb9817d2 to your computer and use it in GitHub Desktop.
Serving both sides in the server file
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
// Make sure to add the `@redwoodjs/project-config` and `@redwoodjs/web-server` packages to the api side: | |
// | |
// ```bash | |
// yarn workspace api add @redwoodjs/project-config @redwoodjs/web-server | |
// ``` | |
import { createServer } from '@redwoodjs/api-server' | |
import { getConfig } from '@redwoodjs/project-config' | |
import { handler as serveWeb } from '@redwoodjs/web-server' | |
import { logger } from 'src/lib/logger' | |
async function main() { | |
const server = await createServer({ | |
logger, | |
}) | |
await Promise.all([ | |
serveWeb({ | |
host: '0.0.0.0', | |
port: 8910, | |
apiUrl: getConfig().web.apiUrl, | |
// Update this to where your api server will be running | |
apiProxyTarget: 'http://0.0.0.0:8911', | |
}), | |
server.start(), | |
]) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment