All Projects → mars → heroku-nextjs-custom-server-express

mars / heroku-nextjs-custom-server-express

Licence: other
Deploy Next.js server-side React apps using a custom Express server to Heroku

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to heroku-nextjs-custom-server-express

Express Babel
Express starter kit with ES2017+ support, testing, linting, and code coverage
Stars: ✭ 621 (+582.42%)
Mutual labels:  heroku, expressjs
Judo Heroes
A React application to showcase rendering with Universal JavaScript
Stars: ✭ 373 (+309.89%)
Mutual labels:  expressjs, universal-app
Heroku Nextjs
⏩ Deploy Next.js universal web apps to Heroku
Stars: ✭ 323 (+254.95%)
Mutual labels:  heroku, universal-app
Webpack2 Express Heroku Starter
Starter app using Webpack 2, Express, setup to deploy to Heroku.
Stars: ✭ 12 (-86.81%)
Mutual labels:  heroku, expressjs
Gitwar
🚀 Gitwar - Compete with Github
Stars: ✭ 44 (-51.65%)
Mutual labels:  heroku, expressjs
ZestX-Frontend
Month-Long Fest Website ZestX with some Awsome UI and Intact Backend. Implemented admin page for user and event management
Stars: ✭ 28 (-69.23%)
Mutual labels:  heroku, expressjs
Fraternate
Fraternate is a standalone copy of the GitHub organization and user interaction framework. Built with Mongo dB | Node.js® | Express.js | Handlebars.js | Bootstrap.
Stars: ✭ 130 (+42.86%)
Mutual labels:  heroku, expressjs
WordNook
Dynamically updating blogging website to upload articles and blog posts on various topics, developed using ejs template engine and node js in the backend.
Stars: ✭ 80 (-12.09%)
Mutual labels:  heroku, expressjs
bdapis
Rest API service. Build with NodeJS, Express, MongoDB
Stars: ✭ 65 (-28.57%)
Mutual labels:  heroku
node
Projeto com os fundamentos em javascript, html, css, node e react dos treinamentos.
Stars: ✭ 14 (-84.62%)
Mutual labels:  expressjs
craft-heroku
🍄 Craft 3, ready for continuous deployment to Heroku.
Stars: ✭ 16 (-82.42%)
Mutual labels:  heroku
link-preview-api
Backed to provide information for link-prevue vue component
Stars: ✭ 31 (-65.93%)
Mutual labels:  heroku
youphonic
an online musical machine interface for building and sharing soundscapes and musical compositions
Stars: ✭ 28 (-69.23%)
Mutual labels:  expressjs
PglRobot
No description or website provided.
Stars: ✭ 12 (-86.81%)
Mutual labels:  heroku
bad-cards-game
Bad Cards Game
Stars: ✭ 23 (-74.73%)
Mutual labels:  heroku
bubbly
Full stack chat application created w/ Next.js, Socket.IO, Express, React and TypeScript
Stars: ✭ 24 (-73.63%)
Mutual labels:  expressjs
typescript-express-starter-template
A lightweight starting template to use Typescript with ExpressJS with no bells and whistles.
Stars: ✭ 16 (-82.42%)
Mutual labels:  expressjs
Backend-NodeJS-Golang-Interview QA
A collection of Node JS and Golang Backend interview questions please feel free to fork and contribute to this repository
Stars: ✭ 122 (+34.07%)
Mutual labels:  expressjs
node-js-starter-kit
This is the starter kit project for node js REST API development with express js, mongodb, typescript, webpack specially designed for REST API projects.
Stars: ✭ 14 (-84.62%)
Mutual labels:  expressjs
heroku-datadog-drain-golang
Funnel metrics from multiple Heroku apps into DataDog using statsd.
Stars: ✭ 34 (-62.64%)
Mutual labels:  heroku

Next.js w/ Custom Express Server example for Heroku

How to use

git clone https://github.com/mars/heroku-nextjs-custom-server-express
cd heroku-nextjs-custom-server-express

Install it and run:

npm install
npm run dev

Then, visit http://localhost:3000/ in your web browser.

Deploy it to the cloud with Heroku:

⚠️ Requires installing Heroku CLI

heroku create
git add .
git commit -m 'Next.js app on Heroku'
git push heroku master

Heroku auto-detects that this is a Node.js app, and then executes:

  • npm install
  • npm run build
  • and then launches the app NODE_ENV=production npm start.

👉 An example deployment of master is running at https://nextjs-server.herokuapp.com/.

The idea behind the example

A version of Next's example/custom-server-express revised to deploy to Heroku.

Most of the times the default Next server will be enough but sometimes you want to run your own server to customize routes or other kind of the app behavior. Next provides a Custom server and routing so you can customize as much as you want.

Because the Next.js server is just a node.js module you can combine it with any other part of the node.js ecosystem. in this case we are using express to build a custom router on top of Next.

The example shows a server that serves the component living in pages/a.js when the route /b is requested and pages/b.js when the route /a is accessed. This is obviously a non-standard routing strategy. You can see how this custom routing is being made inside server.js.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].