-
Notifications
You must be signed in to change notification settings - Fork 0
Fundamentals
You have three primary folders:
- Public
- Resources
- Src
All files that should be publicly available should be placed inside public. For example if you place a index.html file inside public folder then a user can reach that file with the path /index.html.
All private resources should be placed inside here. The reason why this folder exists is when you compile your code the references to this folder will still work and files do not need to be moved to build.
All code should be placed inside the the src folder, this folder will later be compiled from TypeScript to JavaScript. This code can be run with
npm run devand it can be compiled with
npm buildThis is the start of your application, in this file we intitiate the framework and configure some settings. We also expose methods for handling requests 404 request and index action (/ path.
import "module-alias/register"; // Needed for node to handle path aliases used in the application
import Core from "@lib/Core"; // The core of the framework
import Initialize from "@lib/Initialize"; // The base class for Initializing the project
class Start extends Initialize {
core: Core;
constructor() {
super();
this.core = new Core(this);
}
}
new Start();preStart(){
// Called before the server is started
}
postStart() {
// Called after the server has been started
}
noPageFound() {
// 404 handler
this.res.send("404");
}
indexAction() {
// Called whenever the user don't specify a controller, meaning they used the / path
}