Install and Creating project
#
Required EnvironmentFarrow uses the latest TypeScript and Node.js features, so make sure we have the correct version installed before we start!
Node.js v14.0.0
or higher (check current version vianode -v
)TypeScript v4.3.0
or higher(Can be installed with scaffolding if farrow is not introduced in an existing project)
#
Creating projectWe create the project template with create-farrow-app.
Run the following code when using npm
:
Run the following code when using yarn
:
Then follow the prompts given on the command line, enter the project name todo-app
, and select scaffolding farrow-vite-react
.
It will create a full-stack scaffold containing farrow
, vite
and react
.
Execute the following commands in sequence to switch to the project folder, install the dependencies, and start.
#
Project directoryAfter the installation is complete, the project directory is roughly as follows:
In the picture above:
The
server
directory is thefarrow
server-side development directory, where the back-end interface is developed.The
src
directory is the source code directory of thenext.js
page, where the front-end pages are developed.The
farrow-config.js
file is the farrow configuration file, which can configureserver
orapi
-related compilation behavior.The
vite.config.ts
file is avite
configuration file that allows you to configurevite
related behavior
Next, let's unpack the code for developing and using the greet api interface that is already built into the project.