express js
This is a super quick way to make a backend in javascript. It looks a lot like flask, but this is nodejs and not python.
Mostly from :
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/skeleton_website
installation
| install express | |
|---|---|
The express generator allows you to create a skeleton app for further development. You can start the demo with :
| start | |
|---|---|
You will be able to see the demo hello app on http://localhost:3000/ But this will have to be restarted every time you make a change. To have it reload on file changes, you need to install nodemon :
| install nodemon | |
|---|---|
nodemon is a 'monitoring node'. If you run npm start it will internally look in package.json and run the "scripts" section there. In the skeleton application it reads :
So you could also run this with the same result.
| run | |
|---|---|
Or.. the newly installed nodemon, which watches file changes :
| live server | |
|---|---|
Of course we want to just run npm start and you can add other script entries for instance for development :
Now you can choose to run in development/monitoring mode or not