2022年10月20日 星期四

Adding body parser in loopback JS

Problems

By default loopback JS does not include body parser although it is based on Express JS, and official documentation does not mention how to configure in order to add the body parser feature.

Solutions

Update $APP_HOME/server/middleware.json and add the body parser block
"parse": {
    "body-parser#json": {},
    "body-parser#urlencoded": {"params": { "extended": true }}
}

References

How can I use body-parser with LoopBack?

 

沒有留言:

張貼留言