rsnext/examples/custom-server-typescript
Marcos Bérgamo c3e5caf110
docs(examples): improve DX while copying command to create new project (#38410)
* docs(examples): improve DX while copy command to create new project

* chore: apply code review

Co-authored-by: Marcos Bérgamo <Marcos.Bergamo@refinitiv.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-07-26 21:57:48 -05: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 Update default gitignore templates (#39051) 2022-07-26 20:08:40 -05:00
next-env.d.ts Include submodules in exported type definition (#28316) 2021-11-26 14:46:56 +01:00
nodemon.json Remove deprecated static folder (#10632) 2020-02-21 19:09:23 +01:00
package.json Remove licence from all example/package.json that has them (#28007) 2021-08-14 10:48:39 -05:00
README.md docs(examples): improve DX while copying command to create new project (#38410) 2022-07-26 21:57:48 -05: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.

Deploy your own

Deploy the example using Vercel or preview live with StackBlitz

Deploy with Vercel

How to use

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

npx create-next-app --example custom-server-typescript custom-server-typescript-app
yarn create next-app --example custom-server-typescript custom-server-typescript-app
pnpm create next-app --example custom-server-typescript custom-server-typescript-app