mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 05:18:03 +00:00
474b09c7f2
* perf: add perf_hooks * perf: add cache * fix: test * feat: support bloom filter * feat: caching token black list * perf: caching i18n instance * fix: test * fix: test * chore: remove prePerfHooks on app * chore: improve i18n instances cache * chore: remove performance measure * fix: package.json * perf: optimize cache strategy * fix: test * fix: bug * test: storer of auth-manager * fix: afterDestroy hook when updating null value * fix: version * chore: fix bug and add test * fix: test * fix: test
98 lines
1.9 KiB
JavaScript
98 lines
1.9 KiB
JavaScript
const { Application } = require('@nocobase/server');
|
|
const dotenv = require('dotenv');
|
|
const { PerformanceObserver, createHistogram } = require('perf_hooks');
|
|
|
|
dotenv.config();
|
|
|
|
const app = new Application({
|
|
database: {
|
|
logging: false,
|
|
dialect: process.env.DB_DIALECT,
|
|
storage: process.env.DB_STORAGE,
|
|
username: process.env.DB_USER,
|
|
password: process.env.DB_PASSWORD,
|
|
database: process.env.DB_DATABASE,
|
|
host: process.env.DB_HOST,
|
|
port: process.env.DB_PORT,
|
|
timezone: process.env.DB_TIMEZONE,
|
|
tablePrefix: process.env.DB_TABLE_PREFIX,
|
|
schema: process.env.DB_SCHEMA,
|
|
underscored: process.env.DB_UNDERSCORED === 'true',
|
|
},
|
|
resourcer: {
|
|
prefix: '/api',
|
|
},
|
|
logger: {
|
|
// skip: () => true,
|
|
// transports: ['console'],
|
|
// level: 'error',
|
|
},
|
|
acl: false,
|
|
plugins: [],
|
|
perfHooks: true,
|
|
});
|
|
|
|
app.db.collection({
|
|
name: 'users',
|
|
sortable: 'sort',
|
|
fields: [
|
|
{
|
|
name: 'id',
|
|
type: 'bigInt',
|
|
autoIncrement: true,
|
|
primaryKey: true,
|
|
allowNull: false,
|
|
},
|
|
{
|
|
type: 'string',
|
|
name: 'nickname',
|
|
},
|
|
{
|
|
type: 'string',
|
|
name: 'username',
|
|
unique: true,
|
|
},
|
|
{
|
|
type: 'string',
|
|
name: 'email',
|
|
unique: true,
|
|
},
|
|
{
|
|
type: 'string',
|
|
name: 'phone',
|
|
unique: true,
|
|
},
|
|
{
|
|
type: 'password',
|
|
name: 'password',
|
|
hidden: true,
|
|
},
|
|
{
|
|
type: 'string',
|
|
name: 'appLang',
|
|
},
|
|
{
|
|
type: 'string',
|
|
name: 'resetToken',
|
|
unique: true,
|
|
hidden: true,
|
|
},
|
|
{
|
|
type: 'json',
|
|
name: 'systemSettings',
|
|
defaultValue: {},
|
|
},
|
|
],
|
|
});
|
|
|
|
// const obs = new PerformanceObserver((items) => {
|
|
// items.getEntries().forEach((item) => {
|
|
// console.log(item);
|
|
// });
|
|
// });
|
|
// obs.observe({ entryTypes: ['measure'] });
|
|
|
|
app.listen(13030, (err) => {
|
|
console.log('nocobase-server: http://localhost:13030/api/users');
|
|
});
|