mirror of
https://github.com/fazo96/ipfs-boards
synced 2025-01-25 14:54:19 +01:00
29 lines
531 B
JavaScript
Executable File
29 lines
531 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
var ipfs = require('ipfs-api')('localhost','5001')
|
|
var BoardsAPI = require('../lib/boards-api.js')
|
|
var express = require('express')
|
|
var app = express()
|
|
|
|
var boards = new BoardsAPI(ipfs)
|
|
|
|
// Serve web app
|
|
app.use(express.static('../webapp'))
|
|
|
|
// Create gateways to access the BoardsAPI
|
|
|
|
function startWebServer(){
|
|
// Start http server
|
|
app.listen(3000,function(){
|
|
console.log('Started Web Server')
|
|
})
|
|
}
|
|
|
|
boards.init(function(err){
|
|
if(err){
|
|
console.log(err)
|
|
} else {
|
|
startWebServer()
|
|
}
|
|
})
|