Skip to content

Releases: drashland/drash

v0.7.3

07 Apr 21:52
ddb3472
Compare
Choose a tag to compare

v0.7.2

31 Mar 04:30
Compare
Choose a tag to compare

The following classes couldn't be overwritten after turning Drash into a true namespace:

  • Drash.Http.Response
  • Drash.Http.Request

These classes can be overwritten now.

v0.7.1

30 Mar 16:17
fe64b3a
Compare
Choose a tag to compare

Drash is now defined using the namespace keyword: https://github.com/crookse/deno-drash/blob/master/mod.ts

All members should have been exported without breaking changes (as seen by the tests).

Docs are updated: https://crookse.github.io/deno-drash/#/

v0.7.0

30 Mar 01:09
4dee62d
Compare
Choose a tag to compare

v0.6.2

28 Mar 05:35
Compare
Choose a tag to compare

Fixed issue with static files not being served properly. The test directory was hard-coded into Drash.Http.Response. To properly serve static files, set the following env var:

DRASH_SERVER_DIRECTORY

Example:

#!/bin/bash

export DRASH_SERVER_DIRECTORY="/path/that/contains/your/app.ts/file"

Notes

  • Do NOT add a trailing slash
  • The env var is named DRASH_SERVER_DIRECTORY because your app.ts file is essentially a Drash server that starts up a Deno server.

v0.6.1

28 Mar 05:12
Compare
Choose a tag to compare

Fixed generateHtmlResponse() in Drash.Http.Response. Users weren't able to generate their own custom HTML unless they were overriding Drash.Http.Response. This is no longer true. Users can now set a full HTML document (as a string) in this.response.body in a resource class and it will generate whatever was provided.

v0.6.0

25 Mar 03:26
058e740
Compare
Choose a tag to compare

v0.5.0

02 Mar 05:58
94bd9e2
Compare
Choose a tag to compare

What's New

  • Drash.Dictionaries.MimeDb - A dictionary of the db.json file at https://github.com/jshttp/mime-db. This is used in Drash.Services.HttpService.getMimeType() to get the MIME type of a file using the file's name or a URL to a file.

  • Drash.Vendor - A namespace to store third party code using Drash.addMember(name, member).

  • Drash.addMember(name, member) - Add a new member to the Drash.Vendor namespace. This member can be accessed throughout your entire Drash project as long as you import Drash in the file that expects to use a Drash.Vendor member. This member can be anything you want it to be. Example below

// app.ts

import Drash from "https://deno.land/x/drash/mod.ts";

class SomeClassName {
  public sayHello() {
      return "Hello!";
  }
}

Drash.addMember("Greeter", SomeClassName);
// some_file.ts

import Drash from "https://deno.land/x/drash/mod.ts";

let greeter = new Drash.Vendor.Greeter();
console.log(greeter.sayHello());
  • Serve static files by specifying the root path to the static files directory when creating the Drash.Http.Server object:
import Drash from "https://deno.land/x/drash/mod.ts";
import IndexResource from "./src/index_resource.ts";

let server = new Drash.Http.Server({
  address: "localhost:8000",
  response_output: "text/html",
  resources: [IndexResource],
  static_paths: ["/public"]
});

server.run();
  • Drash.Http.Response.sendStatic() - Handles sending respones for static files.

  • Drash.Services.HttpService.getMimeType(file, fileIsUrl) for getting the MIME type of a file or URL:

import Drash from "https://deno.land/x/drash/mod.ts";

Drash.Services.HttpService.getMimeType("some/path/file.js?some=param", true);
// returns "application/javascript"
  
Drash.Services.HttpService.getMimeType("some/path/file.json", true);
// returns "application/json"

Drash.Services.HttpService.getMimeType("file.css");
// returns "text/css"

v0.4.0

27 Feb 06:08
2110142
Compare
Choose a tag to compare

What's New

  • .travis.yml
  • Unit tests. Most of the code is covered. Coveralls will be implemented soon.
  • Drash.Dictionaries.LogLevels
    • Contains a list of log levels and their ranks
  • Drash.Loggers.Logger
    • debug(message): Log debug messages.
    • error(message): Log error messages.
    • fatal(message): Log fatal messages.
    • info(message): Log info messages.
    • trace(message): Log trace messages.
    • warn(message): Log warning messages.
  • Drash.Loggers.ConsoleLogger
    • Inherits Drash.Loggers.Logger and makes its type Logger.TYPE_CONSOLE so that it's messages are written to the console. The FileLogger class is coming soon.
  • Drash.Services.HttpService
    • hydrateHttpRequest(request): Hydrate the request with data that is useful for the Drash.Http.Server class.
    • getHttpRequestUrlQueryParams(request): Get the request's query params by parsing its URL.

Fixes

  • Fixed issue where static properties on the Drash.Http.Server were being used by other servers when they shouldn't have been. These properties are now gone and part of the configs so multiple servers can be created without fear of a cached static property.
  • Fixed type definitions
  • Fixed issue where URL query params weren't being added (thanks unit tests... seriously... unit tests are important)

v0.3.0

25 Feb 22:11
d9eaba8
Compare
Choose a tag to compare

What's New

  • Drash.Util.FileCreator.httpResources(pathToResources: string) to create the .drash_http_resources.ts file. This file contains an import/export list of all of your resources.

    • The contents of the .drash_http_resources.ts file will look similar to:

      import users_resource from "/path/to/your/resources/users_resource.ts";
      import home_resource from "/path/to/your/resources/home_resource.ts";
      export default [
        users_resource,
        home_resource,
      ]
    • Use like so:

      1. Create .drash_setup.ts (or whatever filename you want to use).
      import Drash from "https://raw.githubusercontent.com/crookse/deno-drash/master/mod.ts";
      
      Drash.Util.FileCreator.httpResources("/path/to/your/resources");
      1. Create app.ts (or whatever filename you want to use).
      import Drash from "https://raw.githubusercontent.com/crookse/deno-drash/master/mod.ts";
      import resources from "/path/to/your/resources/.drash_http_resources.ts";
      
      let server = new Drash.Http.Server({
        address: "localhost:8000",
        response_output: "application/json",
        resources: resources
      });
      
      server.run()
      1. Run the setup file and your app.
      $ deno .drash_setup.ts
      $ deno app.ts --allow-net