@redwoodjs/api-server
TypeScript icon, indicating that this package has built-in type declarations

7.4.3 • Public • Published

Redwood Fastify Server

About

This package contains code for Redwood's Fastify server:

  • used during local dev for API Side
  • used for Production Deploys requiring long-running process (i.e. not serverless)

TODO

  • add code structure walk-through
  • add package leads
  • add contributing related info

package.json Server Binaries

Run the Redwood Fastify Server programmatically.

From package.json

  "bin": {
    "rw-api-server-watch": "./dist/watch.js",
    "rw-log-formatter": "./dist/logFormatter/bin.js",
    "rw-server": "./dist/index.js"
  },

Note: because we use Yargs to parse in index, using these within the context of a Redwood CLI command will throw due to Yargs object "collision". Needs to be re-architected in the future.

rw-server

Indended for dev and prototyping (i.e. pre-production).

This command runs both the API and Web server on the same port and is not performant at scale for production use. Instead, use the separate commands to run the API and (if needed) Web servers independently, along with tools like PM2, Nginx, or Kubernetes, which appropriately handle concurrent requests, errors, static asset, etc. for production contexts.

  • Runs web on redwood.toml web.port (default 8910)
  • API listens on web port at path redwood.toml web.apiUrl
  • Command Options:
    • port (default 8910)
    • socket (optional)
    • apiHost (default redwood.toml web.apiUrl)

rw-server api

For production use.

  • Runs api on redwood.toml api.port (default 8911)
  • Command Options:
    • port (default 8911)
    • socket (optional)
    • apiRootPath (default '/')

rw-server web

Not optimized for production use at scale (see comments above for rw-server). Recommended to use CDN or Nginx as performant alternatives.

  • Runs web on redwood.toml web.port (default 8910)
  • GraphQL endpoint is set to redwood.toml web.apiUrl/graphql
  • Command Options:
    • port (default 8910)
    • socket (optional)
    • apiHost (default redwood.toml web.apiUrl)

Readme

Keywords

none

Package Sidebar

Install

npm i @redwoodjs/api-server

Weekly Downloads

41,714

Version

7.4.3

License

MIT

Unpacked Size

129 kB

Total Files

61

Last publish

Collaborators

  • joshgmw
  • selfteachme
  • tobbe
  • desaadi
  • mojombo
  • dac09
  • thedavidprice