Skip to content

A deprecated Deno backend for the Free Daily Story Contest.

Notifications You must be signed in to change notification settings

bramirez96/contest-deno-api

Repository files navigation

Story Squad Rest API

This is a refactor of the existing Story Squad API built in Deno.

Onboarding Checklist

Deno Installation Guide

Database Setup Guide

Running the Server Locally

Here are three options for running the server. There are almost certainly other options, but these are the easiest and most practical that I've found.

Option 1: Denon

Note: This MIGHT only work in Windows, as I have yet to see it work on Mac.
Note 2: At the time of updating this documentation, there is currently a BREAKING bug in the Denon package and not much we can do to fix it. If you encounter an error on installation, please refer to options 2 or 3 instead.

I highly recommend using Denon. It offers two main functionalities that many developers have grown accustomed to from Node development: a file watcher and a script manager. Denon allows you to specify scripts to run in a similar fashion to a Node package.json file. Check out the scripts for this project in scripts.config.ts.

There are two steps to install Denon as a global Bash script:

# Step 1: Install from deno.land
deno install -qAf --unstable --reload https://deno.land/x/denon@2.4.6/denon.ts

# Step 2: Add the denon alias to your shell config
# FOR BASH:
echo 'alias denon="~/.deno/bin/denon.cmd"' >> ~/.bashrc

# FOR ZSH:
echo 'alias denon="~/.deno/bin/denon"' >> ~/.zshrc

Option 2: The Heroku CLI

The Heroku CLI is a decent solution to run your application locally. The Procfile contains a list of scripts used to run various aspects of the project. Follow the documentation from Heroku to install the CLI.

To run the Procfile scripts, simply use the heroku local <scriptname> command with the name of the script you'd like to run:

heroku local start # runs the server
heroku local test # runs the tests
heroku local dev # resets and seeds the database, then runs the server

Option 3: Running Deno Directly

If you don't want the overhead of installing a script runner, you can always run the server with Deno's built-in run script.

deno run --allow-net --allow-env --allow-read --unstable --watch -c ./tsconfig.json src/mod.ts start

If you'd like to run the server NOT in watch mode, remove the --watch flag:

deno run --allow-net --allow-env --allow-read --unstable -c ./tsconfig.json src/mod.ts start

About

A deprecated Deno backend for the Free Daily Story Contest.

Resources

Stars

Watchers

Forks