Code Monkey home page Code Monkey logo

api-university's Introduction

API University

API University is a sample project that provides a RESTful API for managing universities, faculties, and courses. It is built with ASP.NET Core and uses Entity Framework Core to interact with a SQL Server database. This project is meant to serve as an example of how to build a modern web API with the .NET framework and best practices.

Prerequisites

Getting started

  1. Clone this repository: git clone https://github.com/pedroalejandropt/api-university.git
  2. Open the folder project api-university
  3. Run the project npm run server
  4. The API will be available at http://localhost:5000/api

Usage

The API provides endpoints for managing universities, faculties, and courses. All requests require a JSON payload in the request body and return a JSON response.

Endpoints

  • GET /api/universities: Retrieves a list of all universities
  • GET /api/universities/{id}: Retrieves a single university by ID
  • POST /api/universities: Creates a new university
  • PUT /api/universities/{id}: Updates an existing university
  • DELETE /api/universities/{id}: Deletes a university by ID
  • GET /api/universities/{id}/faculties: Retrieves a list of all faculties for a university
  • GET /api/faculties/{id}: Retrieves a single faculty by ID
  • POST /api/faculties: Creates a new faculty
  • PUT /api/faculties/{id}: Updates an existing faculty
  • DELETE /api/faculties/{id}: Deletes a faculty by ID
  • GET /api/faculties/{id}/courses: Retrieves a list of all courses for a faculty
  • GET /api/courses/{id}: Retrieves a single course by ID
  • POST /api/courses: Creates a new course
  • PUT /api/courses/{id}: Updates an existing course
  • DELETE /api/courses/{id}: Deletes a course by ID

Examples

Create a university

POST /api/universities
{
    "name": "University of Example",
    "address": "123 Main St",
    "city": "Exampleville",
    "state": "EX",
    "zip": "12345"
}

Response:

{
    "id": 1,
    "name": "University of Example",
    "address": "123 Main St",
    "city": "Exampleville",
    "state": "EX",
    "zip": "12345"
}

Update a faculty

PUT /api/faculties/1
{
    "name": "New Faculty Name"
}

Response:

{
    "id": 1,
    "name": "New Faculty Name",
    "universityId": 1
}

api-university's People

Contributors

pedroalejandropt avatar

Watchers

 avatar

Forkers

diekotto

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.