Basic http and file-based routing implementation using node core modules. Made for academic purposes to demonstrate what happens behind the scenes of libraries that work with HTTP (ExpressJs).
This project follows the old way of serving views with response headers (HTML only).
Routes is based on .js files inside /routes
folder. root.js
folder is equivalent to /
path.
- main.js - main file that boots the server and listens to port
3000
- router.js - main router logic, it executes the correct route module based on request.
- routesHandler.js - handles the file logic on
/routes
folder. It is the responsible for returning the correct file based on url. - /routes - directory where route files resides. Files inside will be executed once a HTTP request url match a file name.
root.js
is equivalent to/
route.
To run, simply cd to the directory where main.js resides and enter node main.js
- Make routesHandler serve HTML files instead of .js files. (Server-side rendering)
- Request body buffer parser
- Typescript version
- To be continued
Distributed under the MIT License. See LICENSE.txt
for more information.