25 lines
486 B
TypeScript
25 lines
486 B
TypeScript
|
import express from 'express';
|
||
|
import payload from 'payload';
|
||
|
|
||
|
require('dotenv').config();
|
||
|
const app = express();
|
||
|
|
||
|
// Redirect root to Admin panel
|
||
|
app.get('/', (_, res) => {
|
||
|
res.redirect('/admin');
|
||
|
});
|
||
|
|
||
|
// 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);
|