Skip to content

Commit

Permalink
chore(examples): add usage
Browse files Browse the repository at this point in the history
  • Loading branch information
lykmapipo committed Aug 19, 2021
1 parent 5292c96 commit 3e443d0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { merge } from 'lodash';
import express from 'express';
import mquery from '../src';
import express from '../src';

const PORT = 3000;

// prepare express app
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.json({ limit: '2mb' }));
app.use(mquery());

// handle requests
app.get('/', (request, response) => {
const options = merge({}, request.mquery);
response.json(options);
app.all('/', (request, response) => {
const data = merge({}, request.all());
response.json(data);
});

// run express app
Expand Down

0 comments on commit 3e443d0

Please sign in to comment.