This documentation is for SFN 0.4.x, for old version SFN documentation, please click here.
Create a directory to store files of your project, then use the command
SFN is written in TypeScript, which your own code should be as well.
The runtime ts-node is optional, only needed if you want to run your program without compiling.
npm i -g typescript npm i -g ts-node
Since version 0.3.x, SFN uses PM2 as its application manager and load-balancer, so to better deploy your application, you'd also install PM2 and use it to start you application (however it is production environment requirement, not necessary during development).
npm i -g pm2
After you have initiated your project, you can now install SFN by using this command:
npm i sfn
After all files downloaded, type the following command to initiate your project, it will create needed files and directories for you automatically.
But before running this procedure, you have to setup the environment for NodeJS to run user-defined commands. See Command Line.
SFN provides a demo, so you can now start server and see what will happen.
If you have installed ts-node, use this command to start the project.
Otherwise, compile the source code with command:
tsc, then run the command:
And the server should be started in few seconds.
If you have PM2 installed, you can use the following command to start the application, and auto-scale according to the CPU numbers.
pm2 start dist/index.js -i max