-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
28 lines (27 loc) · 783 Bytes
/
index.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
import cors from 'cors';
import express from 'express';
import { maimai } from './routes/index.js';
const server = express();
const PORT = process.env.PORT || 80;
server.use(cors());
server.use('/maimai', maimai);
server.get('/', async (_, res) => {
return res.status(200).json({
success: true,
code: 201,
message: 'Welcome!',
github: 'https://github.com/ST4RCHASER/maimaidx-songs-database'
})
});
server.all('*', (req, res) => {
return res.status(405).json({
success: false,
code: 404,
message: "route '/" + req.url.split('/').slice(-1).pop() + "' not found"
});
})
server.listen(PORT, err => {
if(err) throw err;
console.log("%c Server running on " + PORT, "color: green");
});
export default server;