Skip to content

Instantly share code, notes, and snippets.

@Nishchit14
Created June 17, 2018 09:31
Show Gist options
  • Save Nishchit14/678bb004d2a181be4d1ce2e31ce03fc3 to your computer and use it in GitHub Desktop.
Save Nishchit14/678bb004d2a181be4d1ce2e31ce03fc3 to your computer and use it in GitHub Desktop.
Express vs Koa vs Hapi - Landing Page
//Expressjs landing page
const express = require('express');
const app = express();
app.get('/', (req, res) => {
res.send('Hello world, this is landing page');
});
let server = app.listen(3000, ()=> {
console.log('Express is listening to http://localhost:3000');
});
// ---------------------- //
// Koajs landing
const koa = require('koa');
const app = koa();
app.use( function* (){
this.body = 'Hello world, this is landing page';
});
let server = app.listen(3000, ()=> {
console.log('Koa is listening to http://localhost:3000');
});
// ---------------------- //
const Hapi = require('hapi');
const server = new Hapi.Server(3000);
server.route({
method: 'GET',
path: '/',
handler: (request, reply)=> {
reply('Hello world, this is landing page');
}
});
server.start(()=> {
console.log('Hapi is listening to http://localhost:3000');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment