Releases: drashland/drash
v0.7.3
v0.7.2
v0.7.1
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
v0.6.2
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 yourapp.ts
file is essentially a Drash server that starts up a Deno server.
v0.6.1
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
v0.5.0
What's New
-
Drash.Dictionaries.MimeDb
- A dictionary of thedb.json
file at https://github.com/jshttp/mime-db. This is used inDrash.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 usingDrash.addMember(name, member)
. -
Drash.addMember(name, member)
- Add a new member to theDrash.Vendor
namespace. This member can be accessed throughout your entire Drash project as long as youimport
Drash in the file that expects to use aDrash.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
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 typeLogger.TYPE_CONSOLE
so that it's messages are written to the console. TheFileLogger
class is coming soon.
- Inherits
Drash.Services.HttpService
hydrateHttpRequest(request)
: Hydrate the request with data that is useful for theDrash.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
What's New
-
Drash.Util.FileCreator.httpResources(pathToResources: string)
to create the.drash_http_resources.ts
file. This file contains animport
/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:
- 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");
- 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()
- Run the setup file and your app.
$ deno .drash_setup.ts $ deno app.ts --allow-net
- Create
-