How can I serve NPM packages using Flask?

Go to your static folder and there initialize your npm project.

cd flask_app/static
$ npm init

after installing and saving npm packages you can serve them like this:

<script src="https://stackoverflow.com/questions/24514936/{{ url_for("static', filename="node_modules/toastr/toastr.js")}}"></script>

credits to: https://codeburst.io/creating-a-full-stack-web-application-with-python-npm-webpack-and-react-8925800503d9

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)