rsnext/examples/custom-server-typescript
Luc Leray f52955ec94
Clean up examples package.json (#27121)
Clean up package.json files in the `examples` directory:
- Add `private: true`
- Remove `version` (because they are irrelevant for packages that are not meant to be published)
- Remove `name` (because they are optional for packages that are not meant to be published, and when someone clones an example, they often rename it and the property becomes stale)
- Remove `author`
- Remove `description`
- Remove `license`

Also remove `with-dynamic-app-layout` example completely, since it does the same as `layout-component` (https://github.com/vercel/next.js/pull/27121#discussion_r668178408).

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-12 19:58:03 +00:00
..
pages chore: remove-redundant-example-import (#13175) 2020-05-22 16:13:37 +00:00
server Update custom server examples (#24814) 2021-05-07 18:50:56 +02:00
.babelrc Update custom server examples (#24814) 2021-05-07 18:50:56 +02:00
.gitignore Fix typo in gitignore (#19638) 2020-12-01 17:08:38 +00: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 Remove deprecated static folder (#10632) 2020-02-21 19:09:23 +01:00
package.json Clean up examples package.json (#27121) 2021-07-12 19:58:03 +00:00
README.md docs: add 'Open in StackBlitz' buttons to various examples (#25853) 2021-06-08 20:45:02 +00: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.

Preview

Preview the example live on StackBlitz:

Open in StackBlitz

How to use

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

npx create-next-app --example custom-server-typescript custom-server-typescript-app
# or
yarn create next-app --example custom-server-typescript custom-server-typescript-app