rsnext/examples/custom-server-typescript
Shu Uesugi 6804039e94 Make example READMEs more consistent (#10124)
* npx create → npm init

* Fix inconsistent instructions

* Update amp-first

* Update with-graphql-react

* with-firebase-cloud-messaging

* Update with-higher-order-component

* change create-next-app url

* Update create-next-app instruction

* Update instructions to use npm instead of npx

* Move "the idea behind the example" to top

* Rename

* Rename

* Update contributing.md with a README template
2020-01-16 23:23:56 +01:00
..
pages Format missed files (#7464) 2019-05-29 18:19:32 -07:00
server Move syntax formatting to prettier (#7454) 2019-05-29 13:57:26 +02:00
.babelrc Upgrade next.js version in custom-typescript-server example (#7772) 2019-07-09 13:24:14 -04:00
.gitignore [custom-server-typescript] fixed custom server build issues (#7385) 2019-05-23 14:08:03 -05:00
next-env.d.ts Upgrade next.js version in custom-typescript-server example (#7772) 2019-07-09 13:24:14 -04:00
nodemon.json Apply missing formatting (#8079) 2019-07-23 14:33:49 -04:00
package.json Move cross-env from devDependencies to dependencies (#9580) 2019-12-01 10:36:27 +01:00
README.md Make example READMEs more consistent (#10124) 2020-01-16 23:23:56 +01:00
tsconfig.json Prettier fix (#8754) 2019-09-16 15:24:42 +02:00
tsconfig.server.json [custom-server-typescript] fixed custom server build issues (#7385) 2019-05-23 14:08:03 -05:00

Custom server with TypeScript + Nodemon example

The example shows how you can use TypeScript on both the server and the client while using Nodemon to live reload the server code without affecting the Next.js universal code.

Server entry point is server/index.ts in development and dist/index.js in production. The second directory should be added to .gitignore.

How to use

Using create-next-app

Execute create-next-app with npm or Yarn to bootstrap the example:

npm init next-app --example custom-server-typescript custom-server-typescript-app
# or
yarn create next-app --example custom-server-typescript custom-server-typescript-app

Download manually

Download the example:

curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/custom-server-typescript
cd custom-server-typescript

Install it and run:

npm install
npm run dev
# or
yarn
yarn dev

Deploy it to the cloud with now (download)

now