continuous-integration/drone/push Build is passing
Details
continuous-integration/drone Build was killed
Details
|
10 months ago | |
---|---|---|
.vscode | 10 months ago | |
src | 10 months ago | |
.dockerignore | 11 months ago | |
.drone.yml | 10 months ago | |
.env.template | 11 months ago | |
.gitignore | 10 months ago | |
.npmrc | 11 months ago | |
.nvmrc | 10 months ago | |
.prettierignore | 11 months ago | |
.prettierrc | 11 months ago | |
Dockerfile | 10 months ago | |
LICENSE | 11 months ago | |
Makefile | 10 months ago | |
OpenAPI-Spec.yml | 10 months ago | |
README.md | 10 months ago | |
jest.config.js | 11 months ago | |
package.json | 10 months ago | |
pnpm-lock.yaml | 10 months ago | |
questionnaire.json | 10 months ago | |
tsconfig.json | 11 months ago |
README.md
API Template
This template is to be used for bootstrapping a new API project w/ KoaJS. All of the dependencies that make up the service are listed below.
Dependencies
- @4lch4/koa-oto
-
A library for responding to requests within the Koa framework.
-
- @4lch4/koa-router-printer
-
A Koa middleware that outputs the routes registered to the application.
-
- @4lch4/logger
-
A small utility for logging to console within NodeJS/TypeScript applications.
-
- @koa/router
-
Router middleware for koa. Maintained by Forward Email and Lad.
-
- dayjs
-
2KB immutable date time library alternative to Moment.js with the same modern API.
-
- koa
-
Expressive middleware for node.js using ES2017 async functions.
- Built by the developers of Express.
-
- koa-body
-
A Koa body parser middleware. Supports multipart, urlencoded and JSON request bodies.
-
- koa-helmet
-
Security header middleware collection for Koa.
-
Dev Dependencies
- @types/koa
-
TypeScript definitions for
Koa
.
-
- @types/koa__router
-
TypeScript definitions for
Koa-Router
.
-
- @types/node
-
Provides TypeScript definitions for NodeJS v16 (LTS).
-
- prettier
-
An opinionated code formatter that is used for formatting and linting.
-
- ts-node
-
TypeScript execution environment and REPL for node.js, with source map support.
- In other words, enables you to run a TypeScript file directly without first transpiling it.
- e.g.
ts-node ./src/index.ts
- e.g.
-
- typescript
-
TypeScript is a language for application scale JavaScript development.
- Ensures that I'm transpiling the codebase with the same version of TypeScript across devices.
-
Files
The following list explains the need/use of all the files that are in the repo:
NOTE: There is one exception, which is any index.ts
files in a sub-directory. This is because they only export all of the files within said sub-directory, so they all do roughly the same thing but for their respective directory.
App Root Directory
Name/Path | Description |
---|---|
.dockerignore |
Lists all the files to NOT add to the Docker image when building it. |
.env.template |
A sample .env file that can be used to kickstart a new iteration of the project. Contains all the properties that are necessary for the API to function properly. |
.gitignore |
A standard .gitignore file specifying which files not to include in the git repository. |
.npmrc |
Used to provide npm config settings specifically for this repository/API. |
.nvmrc |
Tells nvm which version of NodeJS to use for this repository/API. |
.prettierignore |
Tells Prettier which files to ignore for all operations. |
.prettierrc |
Provides the custom settings to the Prettier application. |
Dockerfile |
A Dockerfile that can be used to package the API into a Docker image. |
jest.config.js |
Provides the custom config settings to Jest, my test runner of choice. |
LICENSE |
The body text of the license the repository is released under. |
Makefile |
A "manifest" that when combined with GNU Make enable building, testing, and releasing the repository with simple commands. |
package.json |
The standard node package.json file with all the pertinent information regarding the repository as an NPM package. |
pnpm-lock.yaml |
The lock file for pnpm, my package manager of choice over Yarn or NPM. |
questionnaire.json |
Provides all the necessary information to the Sindri-CLI to perform the final step of bootstrapping the project: Replace placeholder variables with project-specific values. |
README.md |
A good ol' fashion README, which you're reading now 😊 |
tsconfig.json |
The config settings used by the TypeScript transpiler. |
src
Directory
The only individual file in the src
directory is the index.ts
file which is the main entrypoint to run the API server. Whenever the app is started, usually via npm start
, then this script is what's run and the following is a list of all the steps performed:
- Import the
getAppConfig
method andServer
class from./src/lib/index.ts
.- The
Server
contains a private instance of theKoa
package. - Also provides some helper functions to help manage its lifecycle.
- The