Johnson Duke

Johnson Duke

1590986373

Drash - A REST Microframework for Deno with Zero Dependencies

Why Use Drash?

Drash is designed to help you build your projects quickly with the ability to scale. You can build an API, a web app, an SPA (like the documentation pages), or even a static HTML site. How you use Drash is up to you, so it can be everything you need and nothing you don’t — like a DRASH tent.

Drash takes concepts from the following:

Thrown into the mix is Drash’s own concepts such as:

  • Documentation-driven development
  • Test-driven development
  • Lowering barriers to usage

Drash does not force you to use all of its code. You can pick and choose which data members you want/need and use them however you deem fit. For example, Drash comes with a console logger and a file logger. If you only want these, then you only import these into your non-Drash project. How you use it is really up to you.

Quick Start

// File: app.ts

import { Drash } from "https://deno.land/x/drash@v1.0.3/mod.ts";

class HomeResource extends Drash.Http.Resource {
  static paths = ["/"];
  public GET() {
    this.response.body = "Hello World! deno + Drash is cool!";
    return this.response;
  }
}

const server = new Drash.Http.Server({
  response_output: "text/html",
  resources: [HomeResource]
});

server.run({
  hostname: "localhost",
  port: 1447
});

console.log("Server listening: http://localhost:1447");
$ deno run --allow-net app.ts
Server listening: http://localhost:1447
$ curl localhost:1447
Hello World! deno + Drash is cool!

Create Drash App

Drash provides a basic tool to help you quickly create a Drash skeleton, with everything working out of the box, ready for you to build something great with.

This tool does not require you to install any Drash scripts or modules. It will create the skeleton of your choice (an API, a full web app, or a full web app with Vue) inside your current working directory.

To get started with the Create Drash App tool, see the following commands:

$ mkdir my-drash-project
$ cd my-drash-project
$ deno run --allow-run --allow-read --allow-write https://deno.land/x/drash@v1.0.3/create_app.ts [OPTIONS]

Display the options with --help:

$ deno run --allow-run https://deno.land/x/drash@v1.0.0/create_app.ts --help

#deno #node #javascript #typescript #web-development

What is GEEK

Buddha Community

Drash - A REST Microframework for Deno with Zero Dependencies
Wilford  Pagac

Wilford Pagac

1594289280

What is REST API? An Overview | Liquid Web

What is REST?

The REST acronym is defined as a “REpresentational State Transfer” and is designed to take advantage of existing HTTP protocols when used for Web APIs. It is very flexible in that it is not tied to resources or methods and has the ability to handle different calls and data formats. Because REST API is not constrained to an XML format like SOAP, it can return multiple other formats depending on what is needed. If a service adheres to this style, it is considered a “RESTful” application. REST allows components to access and manage functions within another application.

REST was initially defined in a dissertation by Roy Fielding’s twenty years ago. He proposed these standards as an alternative to SOAP (The Simple Object Access Protocol is a simple standard for accessing objects and exchanging structured messages within a distributed computing environment). REST (or RESTful) defines the general rules used to regulate the interactions between web apps utilizing the HTTP protocol for CRUD (create, retrieve, update, delete) operations.

What is an API?

An API (or Application Programming Interface) provides a method of interaction between two systems.

What is a RESTful API?

A RESTful API (or application program interface) uses HTTP requests to GET, PUT, POST, and DELETE data following the REST standards. This allows two pieces of software to communicate with each other. In essence, REST API is a set of remote calls using standard methods to return data in a specific format.

The systems that interact in this manner can be very different. Each app may use a unique programming language, operating system, database, etc. So, how do we create a system that can easily communicate and understand other apps?? This is where the Rest API is used as an interaction system.

When using a RESTful API, we should determine in advance what resources we want to expose to the outside world. Typically, the RESTful API service is implemented, keeping the following ideas in mind:

  • Format: There should be no restrictions on the data exchange format
  • Implementation: REST is based entirely on HTTP
  • Service Definition: Because REST is very flexible, API can be modified to ensure the application understands the request/response format.
  • The RESTful API focuses on resources and how efficiently you perform operations with it using HTTP.

The features of the REST API design style state:

  • Each entity must have a unique identifier.
  • Standard methods should be used to read and modify data.
  • It should provide support for different types of resources.
  • The interactions should be stateless.

For REST to fit this model, we must adhere to the following rules:

  • Client-Server Architecture: The interface is separate from the server-side data repository. This affords flexibility and the development of components independently of each other.
  • Detachment: The client connections are not stored on the server between requests.
  • Cacheability: It must be explicitly stated whether the client can store responses.
  • Multi-level: The API should work whether it interacts directly with a server or through an additional layer, like a load balancer.

#tutorials #api #application #application programming interface #crud #http #json #programming #protocols #representational state transfer #rest #rest api #rest api graphql #rest api json #rest api xml #restful #soap #xml #yaml

Johnson Duke

Johnson Duke

1590986373

Drash - A REST Microframework for Deno with Zero Dependencies

Why Use Drash?

Drash is designed to help you build your projects quickly with the ability to scale. You can build an API, a web app, an SPA (like the documentation pages), or even a static HTML site. How you use Drash is up to you, so it can be everything you need and nothing you don’t — like a DRASH tent.

Drash takes concepts from the following:

Thrown into the mix is Drash’s own concepts such as:

  • Documentation-driven development
  • Test-driven development
  • Lowering barriers to usage

Drash does not force you to use all of its code. You can pick and choose which data members you want/need and use them however you deem fit. For example, Drash comes with a console logger and a file logger. If you only want these, then you only import these into your non-Drash project. How you use it is really up to you.

Quick Start

// File: app.ts

import { Drash } from "https://deno.land/x/drash@v1.0.3/mod.ts";

class HomeResource extends Drash.Http.Resource {
  static paths = ["/"];
  public GET() {
    this.response.body = "Hello World! deno + Drash is cool!";
    return this.response;
  }
}

const server = new Drash.Http.Server({
  response_output: "text/html",
  resources: [HomeResource]
});

server.run({
  hostname: "localhost",
  port: 1447
});

console.log("Server listening: http://localhost:1447");
$ deno run --allow-net app.ts
Server listening: http://localhost:1447
$ curl localhost:1447
Hello World! deno + Drash is cool!

Create Drash App

Drash provides a basic tool to help you quickly create a Drash skeleton, with everything working out of the box, ready for you to build something great with.

This tool does not require you to install any Drash scripts or modules. It will create the skeleton of your choice (an API, a full web app, or a full web app with Vue) inside your current working directory.

To get started with the Create Drash App tool, see the following commands:

$ mkdir my-drash-project
$ cd my-drash-project
$ deno run --allow-run --allow-read --allow-write https://deno.land/x/drash@v1.0.3/create_app.ts [OPTIONS]

Display the options with --help:

$ deno run --allow-run https://deno.land/x/drash@v1.0.0/create_app.ts --help

#deno #node #javascript #typescript #web-development

Adonis  Kerluke

Adonis Kerluke

1596509565

RESTful API Design Driven Approach

In this tutorial I will show you the fundamentals of designing a RESTful API specification by applying REST principles and best practices, then you’ll be ready to try my online tutorial: How to design a REST API with API Designer?

If you already know what is meant by API in the context of RESTful web services, you can skip to the next section. If not, read on.

Level-Set on API

The abbreviation API stands for Application Programming Interface this in itself, does not help us understand what it is, however in the context of web services, it can refer to one of two things:

  1. The RESTful API specification is written using a modeling language such as Open API specification or RAML (RESTful API Modeling Language) that defines a contract for how software components can interact with a service.
  2. The implementation of a web service or microservice whose contract is designed by REST principles that describe how other services must interact with it.

In this post, I will use the first understanding of this term. Even though both are correct, the most technically relevant for this post is the first: an API is a contract for how software applications talk to each other.

Level-Set on REST

The acronym REST stands for REpresentational State Transfer. It is an architectural style used to represent the transmission of data from one application component to another. In the context of web services, we are talking about the representation of resources (i.e. data) transferred over HTTP by calling a URI that represents the data and via an HTTP method that represents the action to perform against the given data.

What Is RESTful API design?

RESTful API design is the activity of describing the behavior of a web service in terms of its data structures and the actions you allow other application components to perform on its data by the principles of REST. Those principles are covered later in this blog.

Why Design a RESTful API?

Imagine that you are an Architect (the kind the design building) and you set out to build an office block without a blueprint. You turn up on the first day with a truck full of bricks and some cement. What are the chances that you’ll be successful and build a structure that conforms to code and more importantly, doesn’t fall? It’s about zero. Without a blueprint the chance of failure is high.

The same approach applies to web service development. You need a blueprint, or more appropriately, an API specification. This is necessary to evaluate the API design and solicit feedback before even starting to build the implementation.

In addition to providing a specification for the web service’s development, an API contract serves to document its expected behavior, data types, and security requirements.

You should now be satisfied that API design is necessary for a RESTful web service, and should start to wonder how is the best approach to actually designing an API specification.

API Design Tooling

The tooling chosen by an API designer has substantial influence over the designer’s productivity. Highly productive tools such as the Anypoint API Designer from MuleSoft is perfect for designing APIs with OAS (swagger) or RAML.

#integration #api #rest #rest api #restful #api design #raml #rest api design

A REST microframework for Deno's HTTP server with zero dependencies.

Drash

A REST microframework for Deno’s HTTP server with zero dependencies.

Quick Start

// File: app.ts

import { Drash } from "https://deno.land/x/drash@v1.0.6/mod.ts";

class HomeResource extends Drash.Http.Resource {
  static paths = ["/"];
  public GET() {
    this.response.body = "Hello World! deno + Drash is cool!";
    return this.response;
  }
}

const server = new Drash.Http.Server({
  response_output: "text/html",
  resources: [HomeResource]
});

server.run({
  hostname: "localhost",
  port: 1447
});

console.log("Server listening: http://localhost:1447");
$ deno run --allow-net app.ts
Server listening: http://localhost:1447

$ curl localhost:1447
Hello World! deno + Drash is cool!

Create Drash App

Drash provides a basic tool to help you quickly create a Drash skeleton, with everything working out of the box, ready for you to build something great with.

This tool does not require you to install any Drash scripts or modules. It will create the skeleton of your choice (an API, a full web app, or a full web app with Vue) inside your current working directory.

To get started with the Create Drash App tool, see the following commands:

$ mkdir my-drash-project
$ cd my-drash-project

  • To make an API:

    $ deno run --allow-run --allow-read --allow-write --allow-net https://deno.land/x/drash/create_app.ts --api
    
    
  • To make a web app:

    $ deno run --allow-run --allow-read --allow-write --allow-net https://deno.land/x/drash/create_app.ts --web-app
    
    
  • To make a web app with Vue:

    $ deno run --allow-run --allow-read --allow-write --allow-net https://deno.land/x/drash/create_app.ts --web-app --with-vue
    
    

Display the options with --help:

$ deno run --allow-run --allow-read https://deno.land/x/drash/create_app.ts --help

Documentation

Full Documentation

Lifecycle Diagram

Features

Why Use Drash?

Drash is designed to help you build your projects quickly with the ability to scale. You can build an API, a web app, an SPA (like the documentation pages), or even a static HTML site. How you use Drash is up to you, so it can be everything you need and nothing you don’t — like a DRASH tent.

Drash takes concepts from the following:

Thrown into the mix is Drash’s own concepts such as:

  • Documentation-driven development
  • Test-driven development
  • Lowering barriers to usage

Drash does not force you to use all of its code. You can pick and choose which data members you want/need and use them however you deem fit. For example, Drash comes with a console logger and a file logger. If you only want these, then you only import these into your non-Drash project. How you use it is really up to you.

Contributing

Contributors are welcomed!

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

Download Details:

Author: drashland

Live Demo: https://drash.land/

GitHub: https://github.com/drashland/deno-drash

#deno #javascript #nodejs #node

REST API In Laravel Example

Hello Friends,

Today I will give you information about REST API, REST API is an application program interface that uses HTTP requests to GET, PUT, POST and DELETE data.

In this tutorial I am going to perform CRUD operation using REST API and you can learn how to create REST API with authentication using passport in laravel 6/7 application. here we will get data from API.

REST API In Laravel Example

https://websolutionstuff.com/post/rest-api-in-laravel

#rest api in laravel example #php #rest api #crud operation using rest api #rest api with passport #laravel rest api crud