Skip to content
Bo edited this page Jun 5, 2022 · 1 revision

Node

First you need to install GUN with NPM or other via the command line:

$npm install gun

Note: If you don't have node or npm installed, read this.

Then add this to your server code:

const GUN = require('gun');

Note: GUN comes with many default NodeJS adapters for storage and networking. If you do not want these, just do require('gun/gun') instead.

HTTP

We recommend using a 1-click deploy instead, or running npm start inside of your local GUN repo. However, if you want to install GUN to an existing HTTP server, just pass it the server instance:

const server = require('http').createServer().listen(8080);
const gun = GUN({web: server});

Please see the HTTP(S) example, or Express in the same folder.

Or using --experimental-modules in NodeJS might make import GUN from './node_modules/gun/lib/server.js' work.

This wiki is where all the GUN website documentation comes from.

You can read it here or on the website, but the website has some special features like rendering some markdown extensions to create interactive coding tutorials.

Please feel free to improve the docs itself, we need contributions!

Clone this wiki locally