lib/data.js - git - Webernet Explorer _X
git 🏠 Home 👤 Sign up Self hosted git, retro shell
★ otgit, code hosting from the year 2000 ★
📄 octuna / lib / data.js
20 lines · 0.4 KB · Raw
1const path = require('path');
2const { JsonStore } = require('./store');
3 
4const DATA_DIR = path.join(__dirname, '..', 'data');
5 
6let _users = null;
7let _repos = null;
8 
9function users() {
10 if (!_users) _users = new JsonStore(path.join(DATA_DIR, 'users.json'), {});
11 return _users;
12}
13 
14function repos() {
15 if (!_repos) _repos = new JsonStore(path.join(DATA_DIR, 'repos.json'), {});
16 return _repos;
17}
18 
19module.exports = { users, repos };
20 
Done 🔒 Internet