Skip to content

Commit 11866bd

Browse files
with angular
1 parent cd94539 commit 11866bd

25 files changed

+561
-0
lines changed

with-angular/.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
14+
[*.md]
15+
max_line_length = off
16+
trim_trailing_whitespace = false

with-angular/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DATABASE_URL="postgres://<user>:<password>@<endpoint_hostname>.neon.tech:<port>/<dbname>?sslmode=require"

with-angular/.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db

with-angular/.vscode/extensions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
3+
"recommendations": ["angular.ng-template"]
4+
}

with-angular/.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"name": "ng serve",
7+
"type": "chrome",
8+
"request": "launch",
9+
"preLaunchTask": "npm: start",
10+
"url": "http://localhost:4200/"
11+
},
12+
{
13+
"name": "ng test",
14+
"type": "chrome",
15+
"request": "launch",
16+
"preLaunchTask": "npm: test",
17+
"url": "http://localhost:9876/debug.html"
18+
}
19+
]
20+
}

with-angular/.vscode/tasks.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3+
"version": "2.0.0",
4+
"tasks": [
5+
{
6+
"type": "npm",
7+
"script": "start",
8+
"isBackground": true,
9+
"problemMatcher": {
10+
"owner": "typescript",
11+
"pattern": "$tsc",
12+
"background": {
13+
"activeOnStart": true,
14+
"beginsPattern": {
15+
"regexp": "(.*?)"
16+
},
17+
"endsPattern": {
18+
"regexp": "bundle generation complete"
19+
}
20+
}
21+
}
22+
},
23+
{
24+
"type": "npm",
25+
"script": "test",
26+
"isBackground": true,
27+
"problemMatcher": {
28+
"owner": "typescript",
29+
"pattern": "$tsc",
30+
"background": {
31+
"activeOnStart": true,
32+
"beginsPattern": {
33+
"regexp": "(.*?)"
34+
},
35+
"endsPattern": {
36+
"regexp": "bundle generation complete"
37+
}
38+
}
39+
}
40+
}
41+
]
42+
}

with-angular/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<img width="250px" src="https://raw.githubusercontent.com/neondatabase/website/a898a3ff9c2786a3fd4691d083eb8f3c751e008b/src/images/logo-white.svg" />
2+
3+
# Getting started with Neon and Angular
4+
5+
Run the command below to copy the `.env.example` file:
6+
7+
```
8+
cp .env.example .env
9+
```
10+
11+
## Store your Neon credentials
12+
13+
Store your Neon credentials in your `.env` file.
14+
15+
```
16+
DATABASE_URL="postgres://<user>:<password>@<endpoint_hostname>.neon.tech:<port>/<dbname>?sslmode=require"
17+
```
18+
19+
- `user` is the database user.
20+
- `password` is the database user’s password.
21+
- `endpoint_hostname` is the host with neon.tech as the [TLD](https://www.cloudflare.com/en-gb/learning/dns/top-level-domain/).
22+
- `port` is the Neon port number. The default port number is 5432.
23+
- `dbname` is the name of the database. “neondb” is the default database created with each Neon project.
24+
- `?sslmode=require` an optional query parameter that enforces the [SSL](https://www.cloudflare.com/en-gb/learning/ssl/what-is-ssl/) mode while connecting to the Postgres instance for better security.
25+
26+
**Important**: To ensure the security of your data, never expose your Neon credentials to the browser.
27+
28+
Run the command below to install project dependencies:
29+
30+
```
31+
npm install
32+
```
33+
34+
Run the Angular application using the following command:
35+
36+
```
37+
npm run watch & npm run serve:ssr:with-angular
38+
```

with-angular/angular.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"with-angular": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:application",
15+
"options": {
16+
"outputPath": "dist/with-angular",
17+
"index": "src/index.html",
18+
"browser": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
{
25+
"glob": "**/*",
26+
"input": "public"
27+
}
28+
],
29+
"styles": [
30+
"src/styles.css"
31+
],
32+
"scripts": [],
33+
"server": "src/main.server.ts",
34+
"prerender": false,
35+
"ssr": {
36+
"entry": "server.ts"
37+
}
38+
},
39+
"configurations": {
40+
"production": {
41+
"budgets": [
42+
{
43+
"type": "initial",
44+
"maximumWarning": "500kB",
45+
"maximumError": "1MB"
46+
},
47+
{
48+
"type": "anyComponentStyle",
49+
"maximumWarning": "2kB",
50+
"maximumError": "4kB"
51+
}
52+
],
53+
"outputHashing": "all"
54+
},
55+
"development": {
56+
"optimization": false,
57+
"extractLicenses": false,
58+
"sourceMap": true
59+
}
60+
},
61+
"defaultConfiguration": "production"
62+
},
63+
"serve": {
64+
"builder": "@angular-devkit/build-angular:dev-server",
65+
"configurations": {
66+
"production": {
67+
"buildTarget": "with-angular:build:production"
68+
},
69+
"development": {
70+
"buildTarget": "with-angular:build:development"
71+
}
72+
},
73+
"defaultConfiguration": "development"
74+
},
75+
"extract-i18n": {
76+
"builder": "@angular-devkit/build-angular:extract-i18n"
77+
},
78+
"test": {
79+
"builder": "@angular-devkit/build-angular:karma",
80+
"options": {
81+
"polyfills": [
82+
"zone.js",
83+
"zone.js/testing"
84+
],
85+
"tsConfig": "tsconfig.spec.json",
86+
"assets": [
87+
{
88+
"glob": "**/*",
89+
"input": "public"
90+
}
91+
],
92+
"styles": [
93+
"src/styles.css"
94+
],
95+
"scripts": []
96+
}
97+
}
98+
}
99+
}
100+
}
101+
}

with-angular/package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "with-angular",
3+
"scripts": {
4+
"ng": "ng",
5+
"start": "ng serve",
6+
"build": "ng build",
7+
"watch": "ng build --watch --configuration development",
8+
"test": "ng test",
9+
"serve:ssr:with-angular": "node dist/with-angular/server/server.mjs"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "^18.0.0",
14+
"@angular/common": "^18.0.0",
15+
"@angular/compiler": "^18.0.0",
16+
"@angular/core": "^18.0.0",
17+
"@angular/forms": "^18.0.0",
18+
"@angular/platform-browser": "^18.0.0",
19+
"@angular/platform-browser-dynamic": "^18.0.0",
20+
"@angular/platform-server": "^18.0.0",
21+
"@angular/router": "^18.0.0",
22+
"@angular/ssr": "^18.0.4",
23+
"@neondatabase/serverless": "^0.9.3",
24+
"dotenv": "^16.4.5",
25+
"express": "^4.18.2",
26+
"rxjs": "~7.8.0",
27+
"tslib": "^2.3.0",
28+
"zone.js": "~0.14.3"
29+
},
30+
"devDependencies": {
31+
"@angular-devkit/build-angular": "^18.0.4",
32+
"@angular/cli": "^18.0.4",
33+
"@angular/compiler-cli": "^18.0.0",
34+
"@types/express": "^4.17.17",
35+
"@types/jasmine": "~5.1.0",
36+
"@types/node": "^18.18.0",
37+
"jasmine-core": "~5.1.0",
38+
"karma": "~6.4.0",
39+
"karma-chrome-launcher": "~3.2.0",
40+
"karma-coverage": "~2.2.0",
41+
"karma-jasmine": "~5.1.0",
42+
"karma-jasmine-html-reporter": "~2.1.0",
43+
"typescript": "~5.4.2"
44+
}
45+
}

with-angular/public/favicon.ico

14.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)