crystal-api

Version, currently master branch1 version
  • master branchlatestMar 24, 2025

github.com/Zxce3/Learn-Crystal

idk :trollface:

0 stars
0 dependents
License: not declared

Installation

# Add this to your shard.yml
dependencies:
  crystal-api:
    github: Zxce3/Learn-Crystal
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
no constraint declared
Author
Zxce3
Target
  • crystal-api from src/api.cr

Dependencies

This version declares no dependencies.

README

Learn-Crystal

Project Description

This project is a simple API server built with the Crystal programming language. The purpose of this project is to demonstrate how to create a basic API server using Crystal, including handling HTTP requests, serializing JSON data, and managing sample data.

Installation Instructions

  1. Dependencies: Ensure you have Crystal installed on your system. You can download and install Crystal from the official website: https://crystal-lang.org/install/
  2. Clone the repository:
    git clone https://github.com/Zxce3/Learn-Crystal.git
    cd Learn-Crystal
  3. Install dependencies:
    shards install

Usage Examples

  1. Run the server:

    crystal run src/api.cr

    The server will start running at http://localhost:3000.

  2. Make API requests:

    • Get all users:
      curl http://localhost:3000/api/users
    • Get a user by ID:
      curl http://localhost:3000/api/users/1

API Endpoints

  • GET /api/users: Returns a list of all users.
  • GET /api/users/:id: Returns a user with the specified ID.

Authors and Contributors

  • Zxce3