This will be a post on express examples from very basic examples that are just use expressjs by itself, to more complex projects that use a fair number of npm packages, one or more front end frameworks, or a whole lot of vanilla js code. Learning express is something that will take a fair investment of time, but the more I play around with it the more I begin to like it actually. The framework takes a kind of minimalistic approach just like that of vuejs when it comes to front end frameworks, which I think pares well with express.
There is a lot to know before hand of course, but if you have been playing around with express for a while now and are not looking for some full express app examples of one sort or another on this site this is the right place to be.
For this basic example I am making use of express static as a way to serve up static files, and I am also using body parser as a way to go about parsing incoming requests for data as a special data path.
Here is the app.js file for this simple express.js example. I start my requiring in express and then use the main express function to create an instance of an app. Once I have a main app object I can use the use method of app to make use of express static as a way to host a single index.html file ina public folder.
In this Section I will be briefly writing about all the expressjs example that I have made so far when it comes to starting to make something that is at least starting to look like some kind of project. Many of these are not production worthy, but just sever as some examples to get a general idea of what express is all about when it comes to making full stack web applications. making a real full stack application often requires a great investment of time and effort if it is just one developer doing all the work, which is the case wit me and these examples.
3.1 - A simple markdown editor
I started a project where the idea was to have something that I would start on one computer on my network, and then use a front end system to edit a collection of markdown files on that computer from any computer on the network.
3.2 - Network pointers
This is a simple little network pointers canvas type thing that I started, but did not get around to finishing to work jst the way that I wanted to. However the basic idea was to make something where any user on a network can connect to the sever that is running this, and then will send up with a circle in a canvas that repentants them. So the general idea was to start something that could work as some kind of starting point for network games, but there is still more to work on with this when it comes to the very basics of it.
The server index middleware that is one official middleware created and maintained by the express team, is a nice little basic tool for serving up and index of files in a path. In this example I am making use of the serve index middleware to sever an index of files in a folder, and also making use of the built in express static middleware as a way to sever up a file in that folder as content when the item is client in the index.
A basic text editor example that I started, but never really got around to completing. I just wanted to have a simple little express example that can eb used to create and edit text files from a web browser. I did not get around to adding all the little features that I wanted when it comes to logging in any so forth so it goes without saying that if this is ever to be used it should only be used on a trusted network, and with files that you do not really care about.