Getting started with KoaJs

--

Koa is a new web framework that is provided for creating web applications and APIs. And also this is more powerful and more expressive as well as it allows you to handle callbacks and errors.

Installation

You need to install node v7.6.0 or higher for ES2015 and async function support.

try these codes with your cmd

1) nvm install 7
2) npm i koa
3) node my-koa-app.js

Application

The obligatory My First App application

const Koa = require('koa');
const app = new Koa();

app.use(async ctx => {
ctx.body = 'My First App';
});
app.listen(3000);

now you can run the program and see the “my first app” on localhost:3000

--

--

Janaka Chinthana Dissanayake
Janaka Chinthana Dissanayake

Written by Janaka Chinthana Dissanayake

0 Followers

I am an undergraduate student of SLIIT following BSc.(HonS ) in IT specialization in Software Engineering

No responses yet