• Stars
    star
    854
  • Rank 53,369 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimalist web framework for Deno ported from ExpressJS.

Deno reading an opinionated book

Opine

A minimalist web framework for Deno ported from ExpressJS.

Current version Current test status Deno docs PRs are welcome Opine issues Opine stars Opine forks Opine license Opine is not maintained Published on nest.land

Opine latest /x/ version Minimum supported Deno version Opine dependency count Opine dependency outdatedness Opine cached size


Now in maintenance mode: Deno has introduced Node and NPM compat, considering using Express itself in Deno!

import express from "npm:express";

Express not working for you? Raise an issue on Deno and keep reading for Opine usage 🎉


Table of Contents

Getting Started

import { opine } from "https://deno.land/x/[email protected]/mod.ts";

const app = opine();

app.get("/", function (req, res) {
  res.send("Hello World");
});

app.listen(3000, () =>
  console.log("server has started on http://localhost:3000 🚀")
);

Installation

This is a Deno module available to import direct from this repo and via the Deno Registry.

Before importing, download and install Deno.

You can then import Opine straight into your project:

import { opine } from "https://deno.land/x/[email protected]/mod.ts";

Opine is also available on nest.land, a package registry for Deno on the Blockchain.

import { opine } from "https://x.nest.land/[email protected]/mod.ts";

Features

  • Robust routing
  • Large selection of HTTP helpers including support for downloading / sending files, etags, Content-Disposition, cookies, JSONP etc.
  • Support for static serving of assets
  • View system supporting template engines
  • Content negotiation

Documentation

Quick Start

The quickest way to get started with Opine is to utilize the Opine CLI to generate an application as shown below:

Install the executable. The executable's major version will match Opine's:

deno install -f -q --allow-read --allow-write --allow-net --unstable https://deno.land/x/[email protected]/opine-cli.ts

And follow any suggestions to update your PATH environment variable.

Create the app:

opine-cli --view=ejs hello-deno && cd hello-deno

Start your Opine app at http://localhost:3000/:

deno run --allow-net --allow-read --allow-env mod.ts

Philosophy

The Express philosophy is to provide small, robust tooling for HTTP servers, making it a great solution for single page applications, web sites, hybrids, or public HTTP APIs.

Opine aimed to achieve these same great goals, focussing on providing equivalent robust tooling and features for Deno uses.

Now Deno's Node compatibility layer is maturing sufficiently to support Express out of the box, Opine is operating maintenance mode.

Examples

To run the examples, you have two choices:

  1. Run the example using Deno directly from GitHub, for example:

    deno run --allow-net --allow-read https://raw.githubusercontent.com/cmorten/opine/main/examples/hello-world/index.ts
  2. Clone the Opine repo locally:

    git clone git://github.com/cmorten/opine.git --depth 1
    cd opine

    Then run the example you want:

    deno run --allow-net --allow-read ./examples/hello-world/index.ts

All the examples contain example commands in their READMEs to help get you started for either of the above methods.

Contributing

Contributing guide


License

There are several third party modules that have been ported into this module. Each third party module has maintained it's license and copyrights. The only exception is for Express, from which this entire module has been ported, whose license and copyrights are available at EXPRESS_LICENSE in the root of this repository, and cover all files within the source directory which not been explicitly licensed otherwise.

All modules adapted into this module are licensed under the MIT License.

Opine is licensed under the MIT License.

Icon designed and created by Hannah Morten.

More Repositories

1

superdeno

Super-agent driven library for testing Deno HTTP servers.
TypeScript
122
star
2

superoak

HTTP assertions for Oak made easy via SuperDeno. 🐿 🦕
TypeScript
121
star
3

deno-rollup

Next-generation ES module bundler ported for Deno
TypeScript
74
star
4

oak-http-proxy

Proxy middleware for Deno Oak HTTP servers. 🐿 🦕
TypeScript
41
star
5

luath

Fast front-end development tooling in Deno.
TypeScript
35
star
6

cypress-web-vitals

cypress-web-vitals
JavaScript
19
star
7

deno-react-base-server

Minimal React SSR Base Server in Deno.
TypeScript
17
star
8

opine-http-proxy

Proxy middleware for Deno Opine HTTP servers.
TypeScript
14
star
9

refresh

Simple browser reload on file change middleware for your Deno web applications.
TypeScript
14
star
10

importw

Permission restricted imports for Deno.
TypeScript
12
star
11

grafana-jsx

A JSX library for creating JSON for Grafana.
JavaScript
6
star
12

opine-cli

Opine's application generator
TypeScript
6
star
13

permission-guard

A zero-dependency, minimal permission guard for Deno.
TypeScript
4
star
14

serialize-server-state

A fast, secure serializer for server JSON state.
JavaScript
2
star
15

native_http

Native Deno HTTP client and server implementations
TypeScript
2
star
16

json-jsx

A JSX library for creating JSON.
JavaScript
2
star
17

startr

Yet another opinionated startup script for new macs.
Shell
2
star
18

ayup

For being lazy with what you test.
JavaScript
1
star
19

deno-rollup-react-example

An example of how you can use Rollup with Opine and React in Deno.
TypeScript
1
star
20

denocl

TypeScript
1
star
21

readme-runner

Run code snippets from a README (or any other file).
TypeScript
1
star
22

oceanic-next

Oceanic-Next Theme for Native Mac Terminal
1
star
23

applicationinsights-express-middleware

Express Middleware tracking for Microsoft Application Insights SDK for Node.js.
JavaScript
1
star