Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
♻️ Use extended body parser
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Jul 9, 2020
1 parent e12ae17 commit dff1784
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import fs from "fs";
import dotenv from "dotenv";
import ElasticSearch from "@elastic/elasticsearch";
import AWS from "aws-sdk";
import { json, urlencoded } from "body-parser";
import parser from "body-parser";
import cors from "cors";
import parse from "url-parse";
import createAwsElasticsearchConnector from "aws-elasticsearch-connector";
dotenv.config();
Expand All @@ -32,7 +33,7 @@ const lookup = geolite2.open("GeoLite2-City", (path) => {
});

polka()
.use(cors(), urlencoded(), json())
.use(cors(), parser.urlencoded({ extended: true }), parser.json())
.all("/", (req, res) => {
// Get data from query and body
const data = { ...req.query, date: new Date() };
Expand Down

0 comments on commit dff1784

Please sign in to comment.