24 lines
676 B
TypeScript
24 lines
676 B
TypeScript
import 'dotenv/config';
|
|
import express from 'express';
|
|
import cookieParser from 'cookie-parser';
|
|
import path from 'path';
|
|
import authRouter from './routes/auth';
|
|
import adminRouter from './routes/admin';
|
|
|
|
const app = express();
|
|
|
|
app.use( express.json() );
|
|
app.use( cookieParser() );
|
|
app.use( express.static( path.join( __dirname, '..', '..', 'build', 'app' ) ) );
|
|
|
|
app.use( '/api/auth', authRouter );
|
|
app.use( '/api/admin', adminRouter );
|
|
|
|
app.get( '/', ( _req, res ) =>
|
|
{
|
|
res.redirect( '/login.html' );
|
|
} );
|
|
|
|
const PORT = process.env.PORT ? Number( process.env.PORT ) : 3001;
|
|
app.listen( PORT, () => console.log( `rokojori-auth running on http://localhost:${PORT}` ) );
|