Skip to content

Commit

Permalink
Merge pull request #19 from UoaWDCC/backend/feat/loopback-init
Browse files Browse the repository at this point in the history
Backend/feat/loopback init
  • Loading branch information
GodYazza authored May 14, 2024
2 parents 3165654 + 83f804d commit 613fe79
Show file tree
Hide file tree
Showing 35 changed files with 12,908 additions and 1,668 deletions.
5 changes: 4 additions & 1 deletion api/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
dist
npm-debug.log
/dist
# Cache used by TypeScript's incremental build
*.tsbuildinfo
4 changes: 4 additions & 0 deletions api/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
coverage/
.eslintrc.js
3 changes: 3 additions & 0 deletions api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: '@loopback/eslint-config',
};
67 changes: 67 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# Transpiled JavaScript files from Typescript
/dist

# Cache used by TypeScript's incremental build
*.tsbuildinfo

/.idea/*
/.vscode/*
2 changes: 2 additions & 0 deletions api/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
*.json
7 changes: 7 additions & 0 deletions api/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all",
"arrowParens": "avoid"
}
36 changes: 36 additions & 0 deletions api/DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Developer's Guide

We use Visual Studio Code for developing LoopBack and recommend the same to our
users.

## VSCode setup

Install the following extensions:

- [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- [prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)

## Development workflow

### Visual Studio Code

1. Start the build task (Cmd+Shift+B) to run TypeScript compiler in the
background, watching and recompiling files as you change them. Compilation
errors will be shown in the VSCode's "PROBLEMS" window.

2. Execute "Run Rest Task" from the Command Palette (Cmd+Shift+P) to re-run the
test suite and lint the code for both programming and style errors. Linting
errors will be shown in VSCode's "PROBLEMS" window. Failed tests are printed
to terminal output only.

### Other editors/IDEs

1. Open a new terminal window/tab and start the continuous build process via
`npm run build:watch`. It will run TypeScript compiler in watch mode,
recompiling files as you change them. Any compilation errors will be printed
to the terminal.

2. In your main terminal window/tab, run `npm run test:dev` to re-run the test
suite and lint the code for both programming and style errors. You should run
this command manually whenever you have new changes to test. Test failures
and linter errors will be printed to the terminal.
74 changes: 74 additions & 0 deletions api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# fsae-api

This application is generated using [LoopBack initializer package](https://github.com/loopbackio/create-loopback).

## Install dependencies

By default, dependencies were installed when this application was generated.
Whenever dependencies in `package.json` are changed, run the following command:

```sh
npm install
```

To only install resolved dependencies in `package-lock.json`:

```sh
npm ci
```

## Run the application

```sh
npm start
```

You can also run `node .` to skip the build step.

Open http://127.0.0.1:3000 in your browser.

## Rebuild the project

To incrementally build the project:

```sh
npm run build
```

To force a full build by cleaning up cached artifacts:

```sh
npm run rebuild
```

## Fix code style and formatting issues

```sh
npm run lint
```

To automatically fix such issues:

```sh
npm run lint:fix
```

## Other useful commands

- `npm run migrate`: Migrate database schemas for models
- `npm run openapi-spec`: Generate OpenAPI spec into a file
- `npm run docker:build`: Build a Docker image for this application
- `npm run docker:run`: Run this application inside a Docker container

## Tests

```sh
npm test
```

## What's next

Please check out [LoopBack 4 documentation](https://loopback.io/doc/en/lb4/) to
understand how you can continue to add features to this application.

[![LoopBack](https://loopback.io/images/branding/powered-by-loopback/blue/powered-by-loopback-sm.png)](http://loopback.io/)
20 changes: 0 additions & 20 deletions api/db/User.ts

This file was deleted.

18 changes: 0 additions & 18 deletions api/fly.production.toml

This file was deleted.

18 changes: 0 additions & 18 deletions api/fly.staging.toml

This file was deleted.

25 changes: 0 additions & 25 deletions api/index.ts

This file was deleted.

Loading

0 comments on commit 613fe79

Please sign in to comment.