redweb 0.0.9 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -54,7 +54,12 @@ function RedWeb(options = {}) {
|
|
|
54
54
|
const app = express();
|
|
55
55
|
const { publicPaths, port, listenCallback, services, encoding } = options;
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
// Middleware to parse request bodies based on the specified encoding
|
|
58
|
+
if (encoding === ENCODINGS.json) {
|
|
59
|
+
app.use(bodyParser.json());
|
|
60
|
+
} else if (encoding === ENCODINGS.urlencoded) {
|
|
61
|
+
app.use(bodyParser.urlencoded({ extended: true }));
|
|
62
|
+
}
|
|
58
63
|
|
|
59
64
|
services.forEach(service => app[service.method](service.serviceName, service.function));
|
|
60
65
|
publicPaths.forEach(public_path => app.use(express.static(path.join(process.cwd(), public_path))));
|