DEV Community

Cover image for Fullstacking: Setting up NodeJS + KoaJS
Mark Kop
Mark Kop

Posted on

Fullstacking: Setting up NodeJS + KoaJS

NodeJS

sudo apt install curl
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install nodejs
node --version
npm --version
Enter fullscreen mode Exit fullscreen mode

KoaJS

yarn add koa or npm install koa
Create a file (koa.js) and paste the following:

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

app.use(async ctx => {
  ctx.body = 'Hello World';
});

app.listen(3000, () => console.log('Running on http://localhost:3000/'));
Enter fullscreen mode Exit fullscreen mode

Check http://localhost:3000
Great, it's working!

(by the way)

Latest comments (0)