Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Added app.js
Browse files Browse the repository at this point in the history
  • Loading branch information
qkrwldnjs authored Oct 18, 2022
1 parent 6f55553 commit f2947d2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');

const apiRouter = require('./routes/api');
const chartRouter = require('./routes/charts');
const authRouter = require('./routes/auth');
const playlistRouter = require('./routes/playlist');

const app = express();
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());

// Static Files
app.use('/static/news', express.static('./src/images/news'));
app.use('/static/artist/card', express.static('./src/images/artist/card'));
app.use('/static/artist/big', express.static('./src/images/artist/big'));
app.use('/static/artist/group', express.static('./src/images/artist/group'));
app.use('/static/artist/full', express.static('./src/images/artist/full'));
app.use('/static/lyrics', express.static('./src/lyrics'));
app.use('/static/profile', express.static('./src/images/profile'));

// API Routers
app.use('/api', apiRouter);
app.use('/api', chartRouter);
app.use('/', authRouter);
app.use('/api/playlist', playlistRouter);

app.use(express.static(path.join(__dirname, 'build')));
app.get('/*', (req, res) => {
res.sendFile(path.join(__dirname, 'build/index.html'));
})

app.listen(80, () => console.log('Running'));

0 comments on commit f2947d2

Please sign in to comment.