git ssb

1+

Rômulo Alves / dat-react-native



Tree: 6f207214603cecdfaceac26619937078ba1e2a1b

Files: 6f207214603cecdfaceac26619937078ba1e2a1b / nodejs-assets / nodejs-project / gateway.js

597 bytesRaw
1const DatGateway = require('dat-gateway');
2
3/**
4 * @function default
5 * @param {Number} port Port to start the gateway
6 * @param {String} appPath Path to use as a directory to Dats
7 * @return {Promise} Resolves when the server is started
8 */
9module.exports = (port, appPath) =>
10 new Promise((resolve, reject) => {
11 const gateway = new DatGateway({
12 dir: appPath,
13 max: 20,
14 maxAge: 10 * 60 * 1000 // Ten minutes
15 });
16
17 gateway
18 .listen(port)
19 .then(() => {
20 return resolve();
21 })
22 .catch(err => {
23 return reject(err);
24 });
25 });

Built with git-ssb-web