Ask Documentation
WebsiteGitHubPyPI
  • Introduction
  • Getting Started
    • Install & Get Started
    • Hello, World!
  • Routes & Requests
    • Routes
    • Defining Routes
    • Request Data
    • HTTP Status Codes & Methods
    • CORS
  • Response
    • JSON Response
    • JSON Response With an HTTP Status Code
  • Classes
    • Class Instance Variable
    • Initialization/Constructor Method
  • Data Types
    • Dictionaries
  • Built-in Utilities
    • Quick_set()
    • Deep()
    • Serialize()
    • Require_keys()
    • Random Generators
    • Pattern Matching
    • Email
  • Database
    • Ask and Databases
    • Models/Classes
      • Columns
      • Initialization/Constructor
      • Serialization
      • The &basic decorator
    • CRUD
      • Add
      • Select
      • Update
      • Delete
    • Check if a Row Exists
    • Sorting
    • Database Lists
  • JWT Authentication
    • Introduction
    • Protecting Routes
    • How to Create a Basic Login System
    • Properties & Methods of _auth
    • Making Requests to Protected Routes
  • Decorators
    • What are Decorators?
    • Create and Use Custom Decorators
    • Built-in Decorators
  • Security
    • Hashing
    • Route Security
    • Environment Variables
  • Configuring the Transpiler
  • Askfile.toml
  • Modules & Libraries
    • Importing an Ask Module
    • Includes
    • Importing Python Modules
  • Development Tools
    • Editor Syntax Highlighting
    • Automatic API documentation
    • CLI Flags
    • Running in development mode
    • Versioning System
  • Contribute
    • Feature Requests
    • Bug Reports
    • Contribute Code
Powered by GitBook
On this page
  • Initial Project Setup
  • Hello, World! In Ask.
  • Run the App
Export as PDF
  1. Getting Started

Hello, World!

Beginners guide to Ask

Initial Project Setup

  • Create a new folder.

  • Create a new Python virtual environment:

    • $ python3 -m venv venv

  • Activate it:

    • $ source venv/bin/activate

  • Install Ask.

    • $ pip install ask-lang

Hello, World! In Ask.

  • Create a file called hello_world.ask.

  • Open it in your favourite text editor or IDE, and set the syntax language to Python.

  • Then write the following in the file.

@get('/hello'):
    respond('Hello, World!')

Run the App

  • Open your terminal in the project folder.

  • Make sure that the virtual environment is activated and Ask is installed ($ ask -v).

  • Run your app with:

    • $ ask hello_world.ask

  • This will start a local server on port 5000.

  • Open a browser and navigate to:

    • http://127.0.0.1:5000/hello

    • You should see the message "Hello, World!".

Congratulations! You have now created your first Ask app. You can now move on to the next section of this documentation.

Please let us know if you're facing any problems. We're happy to help!

PreviousInstall & Get StartedNextRoutes

Last updated 4 years ago