-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
41 lines (38 loc) · 1.63 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require('dotenv').config();
const createError = require('http-errors');
const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const app = express();
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
// app.use(express.static(path.join(__dirname, 'public')));
const TagRouter = require('./routes/TagRouter');
const CourseRouter = require('./routes/CourseRouter');
const SectionRouter = require('./routes/SectionRouter');
const LessonRouter = require('./routes/LessonRouter');
const ReviewRouter = require('./routes/ReviewRouter');
const UserRouter = require('./routes/UserRouter');
const S3Router = require('./routes/S3Router');
const BannerRouter = require('./routes/BannerRouter');
const BookmarkRouter = require('./routes/BookmarkRouter');
const EnrollmentRouter = require('./routes/EnrollmentRouter');
const RecommendationRouter = require('./routes/RecommendationRouter');
const SearchRouter = require('./routes/SearchRouter');
const PREFIX = "/api";
app.use(`${PREFIX}/tag`, TagRouter);
app.use(`${PREFIX}/course`, CourseRouter);
app.use(`${PREFIX}/section`, SectionRouter);
app.use(`${PREFIX}/lesson`, LessonRouter);
app.use(`${PREFIX}/review`, ReviewRouter);
app.use(`${PREFIX}/user`, UserRouter);
app.use(`${PREFIX}/s3`, S3Router);
app.use(`${PREFIX}/banner`, BannerRouter);
app.use(`${PREFIX}/bookmark`, BookmarkRouter);
app.use(`${PREFIX}/enrollment`, EnrollmentRouter);
app.use(`${PREFIX}/recommendation`, RecommendationRouter);
app.use(`${PREFIX}/search`, SearchRouter);
module.exports = app;