first draft on the backend, no auth, no subscription, no edition
This commit is contained in:
1 parent
1b0e344f5c
commit
dd339f6899
10 files changed
+6216
No files matched your search
@@ -0,0 +1,14 @@
|
||||
export const capitalize = (string) => {
|
||||
return (string).charAt(0).toUpperCase() + (string).slice(1)
|
||||
}
|
||||
|
||||
export const slugify = (text) => {
|
||||
return text.toString().toLowerCase()
|
||||
.replace(/\s+/g, '-')
|
||||
.replace(/[^\w\-]+/g, '')
|
||||
.replace(/\-\-+/g, '-')
|
||||
.replace(/^-+/, '')
|
||||
.replace(/-+$/, '')
|
||||
}
|
||||
|
||||
export default { capitalize, slugify }
|
||||
@@ -0,0 +1,39 @@
|
||||
const { createLogger, format, transports } = require('winston')
|
||||
const { combine, timestamp, simple } = format
|
||||
|
||||
const options = {
|
||||
file: {
|
||||
level: 'info',
|
||||
filename: '../logs/app.log',
|
||||
handleExceptions: true,
|
||||
json: true,
|
||||
maxsize: 5242880, // 5MB
|
||||
maxFiles: 5,
|
||||
colorize: false,
|
||||
timestamp: true
|
||||
},
|
||||
console: {
|
||||
level: 'debug',
|
||||
handleExceptions: true,
|
||||
json: false,
|
||||
colorize: true,
|
||||
timestamp: true
|
||||
}
|
||||
}
|
||||
|
||||
const logger = createLogger({
|
||||
level: 'info',
|
||||
format: combine(
|
||||
timestamp({
|
||||
format: 'YYYY-MM-DD HH:mm:ss'
|
||||
}),
|
||||
simple()
|
||||
),
|
||||
transports: [
|
||||
new transports.File(options.file),
|
||||
new transports.Console(options.console)
|
||||
],
|
||||
exitOnError: false // do not exit on handled exceptions
|
||||
})
|
||||
|
||||
export default logger
|
||||
Reference in new issue
Block a user