DEV Community

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

Posted on

4 1

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)

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more