* chore: adds whitelabel example * chore: updates readme * chore: updates icon/logo/favicon assets
31 lines
700 B
TypeScript
31 lines
700 B
TypeScript
/* eslint-disable import/no-extraneous-dependencies */
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
import express from 'express';
|
|
import payload from 'payload';
|
|
import path from 'path';
|
|
|
|
require('dotenv').config();
|
|
|
|
const app = express();
|
|
|
|
// Redirect root to Admin panel
|
|
app.get('/', (_, res) => {
|
|
res.redirect('/admin');
|
|
});
|
|
|
|
app.use('/assets', express.static(path.resolve(__dirname, '../assets')));
|
|
|
|
// Initialize Payload
|
|
payload.init({
|
|
secret: process.env.PAYLOAD_SECRET,
|
|
mongoURL: process.env.MONGODB_URI,
|
|
express: app,
|
|
onInit: () => {
|
|
payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`);
|
|
},
|
|
});
|
|
|
|
// Add your own express routes here
|
|
|
|
app.listen(3000);
|