2021-05-03 16:06:05 +00:00
|
|
|
const serverless = require('serverless-http');
|
2021-04-20 23:38:24 +00:00
|
|
|
const express = require('express');
|
|
|
|
const app = express();
|
|
|
|
const data = require('./data/index');
|
|
|
|
const upload = require('./upload/index');
|
2021-04-28 19:58:25 +00:00
|
|
|
const save = require('./save/index');
|
2021-04-28 21:48:35 +00:00
|
|
|
const file = require('./file/index');
|
2021-04-20 23:38:24 +00:00
|
|
|
const bodyParser = require('body-parser');
|
|
|
|
const port = 3000;
|
|
|
|
|
|
|
|
app.use(bodyParser.urlencoded({ extended: true }));
|
|
|
|
app.use(bodyParser.json());
|
|
|
|
|
|
|
|
app.use(express.static('public'));
|
|
|
|
|
|
|
|
app.use('/api/data', data);
|
|
|
|
app.use('/api/upload', upload);
|
2021-04-28 19:58:25 +00:00
|
|
|
app.use('/api/save', save);
|
2021-04-28 21:48:35 +00:00
|
|
|
app.use('/api/file', file);
|
2021-04-20 23:38:24 +00:00
|
|
|
|
2021-05-03 16:06:05 +00:00
|
|
|
// app.listen(port, () => {
|
|
|
|
// console.log(`Listening on port: ${port}`);
|
|
|
|
// });
|
|
|
|
module.exports.handler = serverless(app);
|