< Server-Side Scripting < Introduction

app.js

// Displays 'Hello world!'
//
// References:
//   https://repl.it/languages/express
//   https://expressjs.com/en/starter/hello-world.html

const express = require('express');
const app = express();

app.get('/', (request, response) => {
    response.send('Hello world!');
});

app.listen(3000, () => console.log('server started'));

Try It

Copy and paste the code above into the following free online development environment or use your own Node.js (Express) compiler / interpreter / IDE.

  • Log in to Repl.it. Create a user account if you don't have one already.
This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.