Skip to content

Commit 8c97fab

Browse files
committed
Initial commit
0 parents  commit 8c97fab

17 files changed

+4977
-0
lines changed

.env.example

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# Note we depend on NODE_ENV being set to dictate which of the env variables below get loaded at runtime.
3+
# See README for more details.
4+
5+
# Get this from https://mlab.com/home after you've logged in and created a database
6+
MONGODB_URI=mongodb://<mlab_user>:<mlab_password>@<mlab_connection_url>
7+
8+
# This is standard running mongodb locally
9+
MONGODB_URI_LOCAL=mongodb://localhost:27017/<database>
10+
11+
# Put lots of randomness in these
12+
SESSION_SECRET=ashdfjhasdlkjfhalksdjhflak
13+
14+
# Facebook keys - register your app and get yours here: https://developers.facebook.com/
15+
FACEBOOK_ID=754220301289665
16+
FACEBOOK_SECRET=41860e58c256a3d7ad8267d3c1939a4a
17+
18+
# SendGrid Login - create an account with SendGrid here: https://signup.sendgrid.com/
19+
SENDGRID_USER=myusername
20+
SENDGRID_PASSWORD=mysecurepassword
21+
22+
# Application Port - express server listens on this port (default 3000).
23+
PORT=3000

.eslintignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# /node_modules/* in the project root is ignored by default
2+
# build artefacts
3+
dist/*
4+
coverage/*
5+
# data definition files
6+
**/*.d.ts
7+
# 3rd party libs
8+
/src/public/
9+
# custom definition files
10+
/src/types/

.eslintrc

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"plugin:@typescript-eslint/recommended"
5+
],
6+
"parserOptions": {
7+
"ecmaVersion": 2018,
8+
"sourceType": "module"
9+
},
10+
"rules": {
11+
"semi": [
12+
"error",
13+
"always"
14+
],
15+
"quotes": [
16+
"error",
17+
"single"
18+
],
19+
"@typescript-eslint/explicit-function-return-type": "off",
20+
"@typescript-eslint/no-explicit-any": 1,
21+
"@typescript-eslint/no-inferrable-types": [
22+
"warn",
23+
{
24+
"ignoreParameters": true
25+
}
26+
],
27+
"@typescript-eslint/no-unused-vars": "warn"
28+
}
29+
}

.github/workflows/nodejs.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Node CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-node:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: Use Node.js 12.x
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: 12.x
15+
- name: Get yarn cache directory
16+
id: yarn-cache
17+
run: |
18+
echo "::set-output name=dir::$(yarn cache dir)"
19+
- uses: actions/cache@v1
20+
with:
21+
path: ${{ steps.yarn-cache.outputs.dir }}
22+
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
23+
restore-keys: |
24+
${{ runner.os }}-node-
25+
- name: yarn install, build, and test
26+
run: |
27+
yarn
28+
yarn build
29+
env:
30+
CI: true

.gitignore

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
lib-cov
2+
*.seed
3+
*.log
4+
*.csv
5+
*.dat
6+
*.out
7+
*.pid
8+
*.gz
9+
*.swp
10+
11+
pids
12+
logs
13+
results
14+
tmp
15+
16+
# Build
17+
public/css/main.css
18+
19+
# Coverage reports
20+
coverage
21+
22+
# API keys and secrets
23+
.env
24+
25+
# Dependency directory
26+
node_modules
27+
bower_components
28+
29+
# Editors
30+
.idea
31+
*.iml
32+
33+
# OS metadata
34+
.DS_Store
35+
Thumbs.db
36+
37+
# Ignore built ts files
38+
dist/**/*

.travis.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- "8"
5+
- "9"
6+
- "10"
7+
cache:
8+
yarn: true
9+
script:
10+
- yarn build
11+
- yarn test

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["dbaeumer.vscode-eslint", "ms-azuretools.vscode-cosmosdb"]
3+
}

.vscode/launch.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
// Use IntelliSense to learn about possible Node.js debug attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Program",
9+
"type": "pwa-node",
10+
"program": "${workspaceFolder}/dist/server.js",
11+
"request": "launch",
12+
"preLaunchTask": "npm: build"
13+
},
14+
{
15+
"type": "pwa-node",
16+
"request": "attach",
17+
"name": "Attach by Process ID",
18+
"processId": "${command:PickProcess}"
19+
},
20+
{
21+
"type": "pwa-node",
22+
"request": "launch",
23+
"name": "Jest Current File",
24+
"program": "${workspaceFolder}/node_modules/.bin/jest",
25+
"args": [
26+
"${fileBasenameNoExtension}",
27+
"--detectOpenHandles"
28+
],
29+
"console": "integratedTerminal",
30+
"internalConsoleOptions": "neverOpen",
31+
"windows": {
32+
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
33+
}
34+
},
35+
{
36+
"type": "pwa-node",
37+
"request": "launch",
38+
"name": "Jest all",
39+
"runtimeExecutable": "npm",
40+
"runtimeArgs": [
41+
"run-script",
42+
"test"
43+
],
44+
"skipFiles": [
45+
"<node_internals>/**"
46+
]
47+
},
48+
]
49+
}

.vscode/settings.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Place your settings in this file to overwrite default and user settings.
2+
{
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": true
5+
},
6+
"eslint.validate": ["javascript", "typescript"],
7+
"editor.formatOnSave": true,
8+
"[javascript]": {
9+
"editor.formatOnSave": false
10+
},
11+
"[typescript]": {
12+
"editor.formatOnSave": false
13+
},
14+
"[markdown]": {
15+
"editor.formatOnSave": false
16+
},
17+
"search.exclude": {
18+
"**/node_modules": true,
19+
"**/bower_components": true,
20+
"**/dist": true,
21+
"**/coverage": true
22+
},
23+
"typescript.referencesCodeLens.enabled": true,
24+
"appService.zipIgnorePattern": [".vscode{,/**}"],
25+
"appService.deploySubpath": ""
26+
}

.vscode/tasks.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "build",
9+
"group": {
10+
"kind": "build",
11+
"isDefault": true
12+
}
13+
}
14+
]
15+
}

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# About the project
2+
3+
This is TypeScript backend starter project.

jest.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
globals: {
3+
'ts-jest': {
4+
tsConfig: 'tsconfig.json'
5+
}
6+
},
7+
moduleFileExtensions: [
8+
'ts',
9+
'js'
10+
],
11+
transform: {
12+
'^.+\\.(ts|tsx)$': 'ts-jest'
13+
},
14+
testMatch: [
15+
'**/test/**/*.test.(ts|js)'
16+
],
17+
testEnvironment: 'node'
18+
};

package.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "starter",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "dist/index",
6+
"typings": "dist/index",
7+
"scripts": {
8+
"build": "rimraf dist/* && tsc",
9+
"test": "echo \"Error: no test specified\""
10+
},
11+
"keywords": [],
12+
"author": "",
13+
"license": "ISC",
14+
"dependencies": {
15+
"dotenv": "^8.2.0"
16+
},
17+
"devDependencies": {
18+
"@types/eslint": "^7.2.6",
19+
"@types/jest": "^26.0.20",
20+
"@types/node": "^14.14.22",
21+
"@typescript-eslint/eslint-plugin": "^4.14.2",
22+
"@typescript-eslint/parser": "^4.14.2",
23+
"eslint": "^7.19.0",
24+
"jest": "^26.6.3",
25+
"nodemon": "^2.0.7",
26+
"rimraf": "^3.0.2",
27+
"ts-jest": "^26.5.0",
28+
"ts-node": "^9.1.1",
29+
"typescript": "^4.1.3"
30+
}
31+
}

src/main.ts

Whitespace-only changes.

src/types/.gitkeep

Whitespace-only changes.

tsconfig.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"esModuleInterop": true,
5+
"allowSyntheticDefaultImports": true,
6+
"target": "es2020",
7+
"noImplicitAny": true,
8+
"moduleResolution": "node",
9+
"sourceMap": true,
10+
"outDir": "dist",
11+
"baseUrl": ".",
12+
"paths": {
13+
"*": [
14+
"node_modules/*",
15+
"src/types/*"
16+
]
17+
}
18+
},
19+
"include": [
20+
"src/**/*"
21+
]
22+
}

0 commit comments

Comments
 (0)