| 1234567891011121314151617181920212223242526 |
- // [START functions import]
- const express = require('express');
- const serverLess = require('serverless-http');
- const matchMock = require('./mock/matchMock');
- const app = express();
- app.all('*', (req, res, next) => {
- res.header('Access-Control-Allow-Origin', '*');
- res.header(
- 'Access-Control-Allow-Headers',
- 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild',
- );
- res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
- if (req.method == 'OPTIONS') {
- res.send(200);
- } else {
- next();
- }
- });
- app.use(matchMock);
- exports.handler = serverLess(app);
|