Get started

Initialize new application

Setting SugoiJS application

Setting a SugoiJS application is only two steps away.

Installing @sugoi/cli

$ npm i -g @sugoi/cli

Run SugoiJS initialization wizard

Use the initialization wizard to define your needs.

$ sugoi init <app name> && cd <app name>/server

Or

$ sgi init <app name> && cd <app name>/server

Run

All you left to do is to to run your server!

$ npm start

Development command (live reload)

For using the live reload feature you need to

  1. Build with watch by using the dev action - command session won't get closed

npm run dev

2. Run the server with nodemon - command session won't get closed

npm run start:watch

Enjoy your new server

As soon you will done the installation you should be able to reach http://localhost:3000 for reach the client application andhttp://localhost:3000/index for reach the API endpoint.

File structure

├───client        <-- Your web client application directory
│   └───assets
├───common        <-- Common (shared) files between client and server
└───server        <-- Your SugoiJS server directory
    ├───configuration    <-- Build config (environment based configurations)
    │   └───<env | default>
    |        └── variables.js <-- environment variables for this build
    |        └── security.js <-- server security configurations
    |        └── ssl.js <-- ssl configurations
    |        └── <Custom>.js <-- custom configurations
    └───src       <-- Your server app source code
        ├───app   <-- Bootstrap module, Server initialize and listener files, 'authorization' class(optional)
        │   └───classes
        ├───config     <-- Server configuration (services, paths, etc.)
        └───modules    <-- All of you application modules
            └───index  <-- Single module
                ├───controllers    <-- Modules' controllers
                ├───models         <-- Modules' models(optional)
                └───services       <-- Modules' services

Last updated