Simple ExpressJS Template
Express template with examples for middleware & separated routers
express
alexng353/railway-expressjs-template
Just deployed
This expressjs template is a good starter for anyone. It comes pre-built with good examples for middleware, logging and code-splitting into multiple .js files using express's router object. Comes with thorough documentation in the form of comments that explains what everything in the app does. Have fun with this example and thanks for choosing mine!
Check out src/index.js for some good info about how to start out with express, then checkout src/routes/router_example.js to see how you can make your code neat and tidy by splitting it into multiple files.
Routes: GET "/": returns a nice welcome message GET "/json": returns json welcome message POST "/post": returns a welcome message and any body you pass through the post request GET "/example/router": example nested router spawned in a separate file. Returns a help message.
Files:
src
contains the source code for the serversrc/routes
contains the routes for the serversrc/routes/router_example.js
contains examples pertaining to expressjs routers
Template Content