diff --git a/examples/custom-server-nodemon/README.md b/examples/custom-server-nodemon/README.md new file mode 100644 index 00000000..91ed60e1 --- /dev/null +++ b/examples/custom-server-nodemon/README.md @@ -0,0 +1,29 @@ +[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/custom-server-nodemon) + +# Custom server with Nodemon example + +## How to use + +Download the example [or clone the repo](https://github.com/zeit/next.js): + +```bash +curl https://codeload.github.com/zeit/next.js/tar.gz/master | tar -xz --strip=2 next.js-master/examples/custom-server-nodemon +cd custom-server-nodemon +``` + +Install it and run: + +```bash +npm install +npm run 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 apply [Nodemon](https://nodemon.io/) to a custom server to have live reload of the server code without being affected by the Next.js universal code. diff --git a/examples/custom-server-nodemon/nodemon.json b/examples/custom-server-nodemon/nodemon.json new file mode 100644 index 00000000..ab8591fb --- /dev/null +++ b/examples/custom-server-nodemon/nodemon.json @@ -0,0 +1,3 @@ +{ + "watch": ["server/**/*.js"] +} diff --git a/examples/custom-server-nodemon/package.json b/examples/custom-server-nodemon/package.json new file mode 100644 index 00000000..5d1aa0c0 --- /dev/null +++ b/examples/custom-server-nodemon/package.json @@ -0,0 +1,15 @@ +{ + "scripts": { + "dev": "nodemon server/index.js", + "build": "next build", + "start": "NODE_ENV=production node server/index.js" + }, + "dependencies": { + "next": "^4.1.4", + "react": "^16.2.0", + "react-dom": "^16.2.0" + }, + "devDependencies": { + "nodemon": "^1.12.1" + } +} diff --git a/examples/custom-server-nodemon/pages/a.js b/examples/custom-server-nodemon/pages/a.js new file mode 100644 index 00000000..c5359797 --- /dev/null +++ b/examples/custom-server-nodemon/pages/a.js @@ -0,0 +1,3 @@ +import React from 'react' + +export default () =>