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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS Security LIVE!

Hosted by security experts, AWS Security LIVE! showcases AWS Partners tackling real-world security challenges. Join live and get your security questions answered.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️