Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Getting started

Tiago Peres FranΓ§a edited this page Jun 28, 2022 · 11 revisions

Contents

  1. Pre-installation
  2. Installation
  3. Creating a new project
  4. Running the application
  5. Full documentation for the CLI
  6. Keep reading

Pre-installation

  1. Make sure you have Node installed by using the command node -v. The minimum node version compatible with this lib is 13.2. If Node is not installed or is on an unsupported version, consider installing nvm in your machine. nvm is a tool to manage node versions installed in the system, it's easier to upgrade and switch from one version to another than a pure installation of node. To install nvm, check this link. If you don't want to install nvm, you can also download node from here.

  2. This is optional, but we recommend using yarn instead of npm. If you choose to follow this recommendation, use the command npm install yarn --global.

Installation

In order to make it easier and faster to start up a project with Beagle Backend TS, you should install our CLI tool globally:

yarn global add @zup-it/beagle-backend-cli

Creating a new project

Using the CLI, run the command new with the name of your project:

beagle-ts new [PROJECT NAME]

This command will create the following project structure:

πŸ“¦ project-name
 ┣ πŸ“‚ src
 ┃ ┣ πŸ“‚ screens
 ┃ ┃ ┣ πŸ“œ home.tsx  // example of navigation between screens
 ┃ ┃ ┣ πŸ“œ index.ts  // file where the routes are defined
 ┃ ┃ β”— πŸ“œ welcome.tsx  // example for default page
 ┃ ┣ πŸ“œ config.ts  // file that have methods to get the BeagleTsConfig
 ┃ ┣ πŸ“œ global-context.ts  // declaration of GlobalContext and example for its usage
 ┃ β”— πŸ“œ index.ts  // root of the express app, where everything is set up
 ┣ πŸ“œ .editorconfig
 ┣ πŸ“œ .eslintrc.js
 ┣ πŸ“œ LICENSE
 ┣ πŸ“œ README.md
 ┣ πŸ“œ beagle-ts.json  // configuration file to be used by the CLI and the Express App  
 ┣ πŸ“œ package-lock.json
 ┣ πŸ“œ package.json
 β”— πŸ“œ tsconfig.json

Running the application:

cd [PROJECT NAME]
yarn start

The application will be running at http://localhost:3000 if you didn't change any of the default configurations. This command also starts a websocket server that enables hot-reloading in front-end applications. To know more about this, read this topic.

Full documentation for the CLI

Read the topic Advanced topics: CLI to know more about every command and options of the CLI.

Keep reading

Next topic: Creating your first screen