This documentation is for SFN 0.5.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.
npm i -D typescript npm i -D @types/node
Optionally, you can install ts-node to run the program without compiling source code.
npm i -D 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.
tsc node dist
If you wish to run the project via ts-node, use the following command instead:
ts-node --files src # --files flag must be provided
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 -n my-app