Server-Side Scripting/Introduction/Node.js (Express)

From Wikiversity
Jump to navigation Jump to search

app.js[edit | edit source]

// Displays 'Hello world!'
// References:

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

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

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

Try It[edit | edit source]

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 Create a user account if you don't have one already.