https://github.com/mathiaskandelborg/custom-server-typescript-app
https://github.com/mathiaskandelborg/custom-server-typescript-app
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/mathiaskandelborg/custom-server-typescript-app
- Owner: MathiasKandelborg
- Created: 2018-10-24T15:38:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T16:24:16.000Z (over 7 years ago)
- Last Synced: 2025-02-08T08:12:39.149Z (over 1 year ago)
- Language: TypeScript
- Size: 160 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/custom-server-typescript)
# Custom server with TypeScript + Nodemon example
## How to use
### Using `create-next-app`
Execute [`create-next-app`](https://github.com/segmentio/create-next-app) with [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) or [npx](https://github.com/zkat/npx#readme) to bootstrap the example:
```bash
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
```
### Download manually
Download the example:
```bash
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:
```bash
npm install
npm run dev
# or
yarn
yarn dev
```
Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))
```bash
now
```
## The idea behind the example
The example shows how you can use [TypeScript](https://typescriptlang.com) on both the server and the client while using [Nodemon](https://nodemon.io/) to live reload the server code without affecting the Next.js universal code.
Server entry point is `server/index.ts` in development and `production-server/index.js` in production.
The second directory should be added to `.gitignore`.