DEV Community

VICTOR OMONDI
VICTOR OMONDI

Posted on

Hello World Web server in Flask vs Express

Flask

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return "<h1>Hello World!</h1>"

app.run(None, 3001, True)
Enter fullscreen mode Exit fullscreen mode

Express

const express = require('express');

const app = express();

app.get('/', (req, res) => {
    return res.send('<h1>Hello World!</h1>');
});

app.listen(3000);
Enter fullscreen mode Exit fullscreen mode

Discussion (0)