| 1234567891011121314151617181920212223242526 |
- const express = require('express')
- const bodyParser = require('body-parser')
- const app = express()
- const sendemail = require('./sendemail')
- const verification = require('./verification')
- app.all('*', (req, res, next) => {
- res.header("Access-Control-Allow-Origin", req.headers.origin); //设置来源
- res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
- res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
- res.header("Access-Control-Max-Age", "604800000");
- res.header("Access-Control-Allow-Credentials", true);
- res.header("X-Powered-By", ' 3.2.1');
- // res.header("Content-Type", "application/json;charset=utf-8");
- next();
- });
- app.use(bodyParser.urlencoded({extended:false}))
- app.use('/postemail', sendemail)
- app.use('/verification', verification)
- app.listen('8081', () => {
- console.log('http://127.0.0.1:8081')
- })
|