2015-11-04 16:08:33 +01:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
var ipfs = require('ipfs-api')('localhost','5001')
|
2015-11-04 16:41:17 +01:00
|
|
|
var express = require('express')
|
|
|
|
var app = express()
|
2015-11-04 16:08:33 +01:00
|
|
|
|
2015-11-04 16:41:17 +01:00
|
|
|
// Serve files in ./static
|
|
|
|
app.use(express.static('static'))
|
2015-11-04 16:08:33 +01:00
|
|
|
|
2015-11-09 17:12:11 +01:00
|
|
|
app.get('/@:user/:board',function(req,res){
|
|
|
|
ipfs.cat(req.params.user+'/'+req.params.board,function(err,res){
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2015-11-04 16:41:17 +01:00
|
|
|
// CatchAll route: serve the angular app
|
2015-11-09 17:12:11 +01:00
|
|
|
/*app.get('*',function(req,res){
|
2015-11-04 16:41:17 +01:00
|
|
|
res.sendFile(__dirname+'/static/index.html')
|
2015-11-09 17:12:11 +01:00
|
|
|
})*/
|
2015-11-04 16:41:17 +01:00
|
|
|
|
|
|
|
// Start http server
|
|
|
|
app.listen(3000,function(){
|
|
|
|
console.log('Started')
|
|
|
|
})
|