English | Français | 日本語 | Español
A hello-world Node.js web app. Deploy it free from its GitHub address with the MitsuruTech
deploy a web app from GitHub feature: no account, nothing to
install. It is small enough to be a first test of deploying to learntools.dev, and the steps
are in the manual's guide to deploying Python, Node, Go and Java apps from GitHub.
Language Node
Build npm ci
Start npm start
Those are the platform's defaults; nothing here needs changing.
Two things worth copying into your own project:
- Read
process.env.PORT. The platform picks the port and tells you; a server on its own favourite port answers nothing. - Bind
0.0.0.0, notlocalhost. The proxy reaches your app from outside its container.
package-lock.json is committed and has to be, even with no dependencies. npm ci
refuses to run without one: "can only install with an existing package-lock.json". So a
project that has never run npm install fails to build with a message about lockfiles rather
than about anything you wrote. Generate one with npm install and commit it.
npm start
This work is licensed under CC BY-NC-SA 4.0. You may share it and adapt it for learning and teaching, if you credit Mitsuru Technologies Ltd, do not use it commercially, and share anything you make from it under the same licence. The full text is in the LICENSE file.
Made by Mitsuru Technologies for the MitsuruTech Learning Platform: Python, Java, Go, Node, SQL and Linux in the browser for schools and colleges, with container labs, web apps deployed from GitHub, and quizzes that mark themselves. Try code with no account in the playground.
Teaching a class? See the price or create a college account.