1
0
mirror of https://github.com/fazo96/ipfs-boards synced 2025-03-13 21:58:38 +01:00
ipfs-boards/server.js

25 lines
517 B
JavaScript
Raw Normal View History

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')
})