Create a package
There are two ways to create a fastn package:
Using Command (Recommended)
Manual
Using Command
The simplest way to create a `fastn` package is to use the command line tool.
Suppose you want to create a package named `hello-fastn`, you need to follow
these steps:
- [Open the Terminal (Linux/MacOS) or Command prompt (Windows)](open-terminal/)
- Run the following command in terminal
fastn create-package hello-fastn
The above command will create a folder named `hello-fastn` containing two files:
[`FASTN.ftd`](create-fastn-package/#fastn-ftd) and [`index.ftd`](create-fastn-package/#index-ftd). You can view the contents of this folder in
a text editor such as [SublimeText](https://www.sublimetext.com/3).
Serving the package
After creating the package as described above, you can start the HTTP server.
Follow these steps:
- [Open the Terminal (Linux/MacOS) or Command prompt (Windows)](open-terminal/)
- Navigate to the package location in the terminal using the `cd
` command.go to the package location
cd hello-fastn
- Once you are in the package location, run the following command to start the
HTTP server:
After starting the HTTP server, open any web browser and type
"http://127.0.0.1:8000" into the URL bar. Voila! You can now view your "hello
world" page in the browser.
`FASTN.ftd`
`FASTN.ftd` is a configuration file where we set configuration for the package.
In `FASTN.ftd`, the code should look like this:
-- import: fastn
-- fastn.package: hello-fastn
In the code above, we set the package name as`hello-fastn`.
`index.ftd`
`index.ftd` is the index page of your package. You can think of the index page
as being the home or default page of your package.
In `index.ftd`, the code should look like this:
In the code above, we added a kernel component `ftd.text` and passed `Hello
World` as the value for `text` property.