Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const bodyParser = require('body-parser');
const express = require('express');
const { bottender } = require('bottender');
const app = bottender({
dev: process.env.NODE_ENV !== 'production',
});
const port = Number(process.env.PORT) || 5000;
const handle = app.getRequestHandler();
app.prepare().then(() => {
const server = express();
server.use(
bodyParser.json({
verify: (req, _, buf) => {
req.rawBody = buf.toString();
},
})
const Koa = require('koa');
const Router = require('koa-router');
const bodyParser = require('koa-bodyparser');
const { bottender } = require('bottender');
const app = bottender({
dev: process.env.NODE_ENV !== 'production',
});
const port = Number(process.env.PORT) || 5000;
const handle = app.getRequestHandler();
app.prepare().then(() => {
const server = new Koa();
const router = new Router();
router.get('/api', ctx => {
ctx.response.body = { ok: true };
});
router.all('*', async ctx => {
const restify = require('restify');
const { bottender } = require('bottender');
const app = bottender({
dev: process.env.NODE_ENV !== 'production',
});
const port = Number(process.env.PORT) || 5000;
const handle = app.getRequestHandler();
app.prepare().then(() => {
const server = restify.createServer();
server.use(restify.plugins.queryParser());
server.use(restify.plugins.bodyParser());
server.get('/api', (req, res) => {
res.send({ ok: true });
});