Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit f0402e2

Browse files
committed
chore(init): Create application based on nest-permissions-seed
Last first source commit: EndyKaufman/nest-permissions-seed@15a713b
0 parents  commit f0402e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+8780
-0
lines changed

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# config
2+
.env
3+
4+
# dependencies
5+
/node_modules
6+
7+
# IDE
8+
.idea/
9+
.vscode/
10+
node_modules/
11+
build/
12+
tmp/
13+
temp/
14+
/.idea
15+
/.awcache
16+
/.vscode
17+
18+
# misc
19+
npm-debug.log
20+
21+
# example
22+
/quick-start
23+
24+
# tests
25+
/test
26+
/coverage
27+
/.nyc_output
28+
29+
# dist
30+
/dist
31+
/database/sqlitedb.db
32+
/database/sqlitedb.db
33+
/www

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
cache:
3+
directories:
4+
- node_modules
5+
node_js:
6+
- '7'
7+
- '6'

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## rucken-core-nestjs
2+
[![Greenkeeper badge](https://badges.greenkeeper.io/rucken/core-nestjs.svg)](https://greenkeeper.io/)
3+
[![Build Status][travis-image]][travis-url]
4+
[![dependencies-release][dependencies-image]][dependencies-url]
5+
6+
7+
A simple application demonstrating the basic usage of permissions with [NestJS](https://nestjs.com).
8+
9+
## Usage
10+
- clone or fork [repository](https://github.com/rucken/core-nestjs.git) `git clone --recursive https://github.com/rucken/core-nestjs.git`
11+
- make sure you have [node.js](https://nodejs.org/) installed version 6+
12+
- make sure you have NPM installed version 3+
13+
- run `npm install` to install project dependencies
14+
- copy `_env` to `.env` and set environments for use
15+
- run `npm run schema:sync` to create all tables in database
16+
- run `npm run migrate:run` to run all migrations
17+
- run `npm run start:prod` to fire up prod server (`npm run start:watch` - dev server)
18+
- Open browser to [`http://localhost:3000`](http://localhost:3000)
19+
20+
## Demo application on [Heroku](https://rucken-core-nestjs.herokuapp.com)
21+
22+
### Users
23+
- user with admin group: [email protected], password: 12345678
24+
- user with user group: [email protected], password: 12345678
25+
- user with user group: [email protected], password: 12345678
26+
27+
### Swagger
28+
- local: http://localhost:3000/swagger
29+
- online: https://rucken-core-nestjs.herokuapp.com/swagger
30+
31+
- apiKey template: ```JWT <token_generated_on_login>```
32+
33+
34+
## License
35+
36+
MIT
37+
38+
[travis-image]: https://travis-ci.org/rucken/core-nestjs.svg?branch=master
39+
[travis-url]: https://travis-ci.org/rucken/core-nestjs
40+
[dependencies-image]: https://david-dm.org/rucken/core-nestjs/status.svg
41+
[dependencies-url]: https://david-dm.org/rucken/core-nestjs

_env

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DEBUG=true
2+
PORT=3000
3+
SECRET_KEY=secret_key
4+
JWT_EXPIRATION_DELTA=7 days
5+
JWT_AUTH_HEADER_PREFIX=JWT
6+
DATABASE_URL=sqlite://database/sqlitedb.db
7+
#DATABASE_URL=postgres://USER:PASSWORD@HOST:1105/NAME
8+
#DATABASE_URL=sqlite://db.sqlite3
9+
#DATABASE_URL=oracle://USER:PASSWORD@HOST:1105/NAME
10+
#DATABASE_URL=mysql://USER:PASSWORD@HOST:1105/NAME
11+
#DATABASE_URL=redis://USER:PASSWORD@HOST:1105
12+
#DATABASE_URL=memcached://USER:PASSWORD@HOST:1105
13+
#DATABASE_URL=ocmem://HOST:1105/PATH

bin/post_compile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# !/usr/bin/env bash
2+
npm i
3+
npm run build

database/.gitkeep

Whitespace-only changes.

index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require('ts-node/register');
2+
require('./src/server');
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+

nodemon.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"watch": ["src"],
3+
"ext": "ts",
4+
"ignore": ["src/**/*.spec.ts"],
5+
"exec": "node ./index"
6+
}

ormconfig.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
const ConnectionString = require('connection-string').ConnectionString;
2+
const config = require('dotenv').config;
3+
const path = require('path');
4+
5+
config();
6+
7+
const connectionString = new ConnectionString(process.env.DATABASE_URL);
8+
9+
if (connectionString.protocol === 'sqlite') {
10+
module.exports = {
11+
type: 'sqlite',
12+
database: './' + connectionString.host + (connectionString.segments.length ? '/' + connectionString.segments[0] : ''),
13+
entities: [
14+
'src/**/entities/**/*.entity.ts',
15+
],
16+
migrations: [
17+
'src/**/migrations/**/*.ts'
18+
],
19+
subscribers: [
20+
'src/**/subscribers/**/*.ts'
21+
],
22+
logging: 'all',
23+
synchronize: false,
24+
}
25+
} else {
26+
module.exports = {
27+
type: connectionString.protocol,
28+
host: connectionString.host,
29+
port: +connectionString.port,
30+
username: connectionString.user,
31+
password: connectionString.password,
32+
database: connectionString.segments[0],
33+
entities: [
34+
'src/**/entities/**/*.entity.ts',
35+
],
36+
migrations: [
37+
'src/**/migrations/**/*.ts'
38+
],
39+
subscribers: [
40+
'src/**/subscribers/**/*.ts'
41+
],
42+
logging: 'all',
43+
synchronize: false,
44+
}
45+
}

0 commit comments

Comments
 (0)