Created
June 17, 2018 09:31
-
-
Save Nishchit14/678bb004d2a181be4d1ce2e31ce03fc3 to your computer and use it in GitHub Desktop.
Express vs Koa vs Hapi - Landing Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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