Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const express = require('express');
- const bodyParser = require('body-parser');
- let app = express();
- let path = require('path');
- //app.use(express.static(process.argv[3]||path.join(__dirname, 'public')));
- app.use(bodyParser.json());
- app.use(bodyParser.urlencoded({ extended: true }));
- app.use((req, res, next) => {
- res.header('Content-Type', 'application/json');
- next();
- });
- app.use(express.static(__dirname + '/'));
- app.get('/index', (req, res) => {
- res.sendFile(__dirname + '/index.html');
- })
- app.get('/search', (req, res) => {
- code = req.query
- ver = JSON.stringify({ code }, null, '');
- // res.send(JSON.stringify({ code }, null, ''));
- res.redirect('/res');
- })
- app.get('/res', (req, res) => {
- res.send(ver)
- })
- app.listen(process.argv[2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement