// Catch sefaults
require('segfault-handler').registerHandler()
-// Static files
-app.use(express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
-
// API routes
var api_route = '/api/' + constants.API_VERSION
app.use(api_route, routes.api)
+// Static files
+app.use('/app', express.static(path.join(__dirname, '/client'), { maxAge: 0 }))
+// 404 for static files not found
+app.use('/app/*', function (req, res, next) {
+ res.sendStatus(404)
+})
+
// Client application
app.use('/*', function (req, res, next) {
res.sendFile(path.join(__dirname, 'client/index.html'))
res.sendStatus(err.status || 500)
})
+// TODO: move into initializer
+require('./server/models/users').createClient('coucou', [ 'password' ], function (err, id) {
+ if (err) throw err
+ logger.info('Client id: ' + id)
+
+ require('./server/models/users').createUser('floflo', 'coucou', function () {})
+})
+
// ----------- Create the certificates if they don't already exist -----------
peertubeCrypto.createCertsIfNotExist(function (err) {
if (err) throw err