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

Commit 39a8f20

Browse files
authored
Cleaned up README.md (#315)
thx to @wmundev!
1 parent 66942a8 commit 39a8f20

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ It is not a goal to be a comprehensive and definitive guide to making a TypeScri
1717
- [Pre-reqs](#pre-reqs)
1818
- [Getting started](#getting-started)
1919
- [Deploying the app](#deploying-the-app)
20-
- [Pre-reqs](#pre-reqs-1)
20+
- [Pre-reqs](#Prerequisites)
2121
- [Deploying to Azure App Service](#deploying-to-azure-app-service)
2222
- [TypeScript + Node](#typescript--node)
2323
- [Getting TypeScript](#getting-typescript)
@@ -28,7 +28,7 @@ It is not a goal to be a comprehensive and definitive guide to making a TypeScri
2828
- [Testing](#testing)
2929
- [ESLint](#eslint)
3030
- [Dependencies](#dependencies)
31-
- [`dependencies`](#dependencies-1)
31+
- [`dependencies`](#dependencies)
3232
- [`devDependencies`](#devdependencies)
3333
- [Hackathon Starter Project](#hackathon-starter-project)
3434

@@ -75,12 +75,12 @@ npm start
7575
Or, if you're using VS Code, you can use `cmd + shift + b` to run the default build task (which is mapped to `npm run build`), and then you can use the command palette (`cmd + shift + p`) and select `Tasks: Run Task` > `npm: start` to run `npm start` for you.
7676

7777
> **Note on editors!** - TypeScript has great support in [every editor](http://www.typescriptlang.org/index.html#download-links), but this project has been pre-configured for use with [VS Code](https://code.visualstudio.com/).
78-
Throughout the README We will try to call out specific places where VS Code really shines or where this project has been setup to take advantage of specific features.
78+
Throughout the README We will try to call out specific places where VS Code really shines or where this project has been set up to take advantage of specific features.
7979

8080
Finally, navigate to `http://localhost:3000` and you should see the template being served and rendered locally!
8181

8282
# Deploying the app
83-
There are many ways to deploy an Node app, and in general, nothing about the deployment process changes because you're using TypeScript.
83+
There are many ways to deploy a Node app, and in general, nothing about the deployment process changes because you're using TypeScript.
8484
In this section, I'll walk you through how to deploy this app to Azure App Service using the extensions available in VS Code because I think it is the easiest and fastest way to get started, as well as the most friendly workflow from a developer's perspective.
8585

8686
## Prerequisites
@@ -91,11 +91,11 @@ The Azure free tier gives you plenty of resources to play around with including
9191
- **Create a cloud database** -
9292
For local development, running MongoDB on localhost is fine, however once we deploy we need a database with high availability.
9393
The easiest way to achieve this is by using a managed cloud database.
94-
There are many different providers, but the easiest one to get started with is [MongoLab](#mlab).
94+
There are many different providers, but the easiest one to get started with is [MongoLab](#Create a managed MongoDB with MongoLab).
9595
- **SendGrid Account** -
96-
If you don't have one, you can sign up for free, we will need it to send emails. There are many different providers that Nodemailer supports ([Well-known services](https://nodemailer.com/smtp/well-known/)), we'll be using [SendGrid](#sendgrid).
96+
If you don't have one, you can sign up for free, we will need it to send emails. There are many different providers that Nodemailer supports ([Well-known services](https://nodemailer.com/smtp/well-known/)), we'll be using [SendGrid](#SendGrid Account).
9797

98-
### <a name="mlab"></a> Create a managed MongoDB with MongoLab
98+
### Create a managed MongoDB with MongoLab
9999
1. Navigate to [MongoLab's Website](https://mlab.com/), sign up for a free account, and then log in.
100100
2. In the **MongoDB Deployments** section, click the **Create New** button.
101101
3. Select any provider (I recommend **Microsoft Azure** as it provides an easier path to upgrading to globally distributed instances later).
@@ -114,7 +114,7 @@ You can test that it works locally by updating `MONGODB_URI_LOCAL` to the same c
114114
After rebuilding/serving, the app should work, but users that were previously created in local testing will not exist in the new database!
115115
Don't forget to return the `MONGO_URI_LOCAL` to your local test database (if you so desire).
116116

117-
### <a name="sendgrid"></a> SendGrid Account
117+
### SendGrid Account
118118
1. Navigate to [SendGrid's Website](https://sendgrid.com/), sign up for a free account, and complete the verification process.
119119
2. Open your `.env` file and update `SENDGRID_USERNAME` and `SENDGRID_PASSWORD` with your SendGrid username and password respectively.
120120

@@ -136,7 +136,7 @@ Deploying from VS Code can be broken into the following steps:
136136
5. Paste in the code that is on your clipboard.
137137
6. Go back to VS Code, you should now be signed in.
138138
You can confirm that everything worked by seeing your Azure subscription listed in the Azure App Service section of the explorer window.
139-
Additionally you should see the email associated with your account listed in the status bar at the bottom of VS Code.
139+
Additionally, you should see the email associated with your account listed in the status bar at the bottom of VS Code.
140140

141141
### Build the app
142142
Building the app locally is required to generate a zip to deploy because the App Service won't execute build tasks.
@@ -152,10 +152,10 @@ If you haven't changed the name, this will be `TypeScript-Node-Starter`.
152152
4. Choose the subscription you want this app to be billed to (don't worry, it will be free).
153153
5. Choose `Create New Web App`
154154
6. Enter a globally unique name -
155-
This will be part of the URL that azure generates so it has to be unique, but if you're planning on adding a custom domain later, it's not that important. I usually just add random numbers to the end of the app name, ie. typescript-node-starter-15121214.
155+
This will be part of the URL that azure generates, so it has to be unique, but if you're planning on adding a custom domain later, it's not that important. I usually just add random numbers to the end of the app name, ie. typescript-node-starter-15121214.
156156
7. Choose a resource group -
157157
If you don't know what this is, just create a new one.
158-
If you have lots of cloud resources that should be logically grouped together (think an app service and a database that supports that app) then you would want to put them in the same resource group.
158+
If you have lots of cloud resources that should be logically grouped together (think an app service, and a database that supports that app) then you would want to put them in the same resource group.
159159
This can always be updated later though.
160160
If you create a new resource group, you'll also be prompted to pick a location for that group.
161161
Pick something geographically close to where your users are.
@@ -170,15 +170,15 @@ All of this is powered by the [Azure CLI](https://docs.microsoft.com/en-us/cli/a
170170
This deployment is not the fastest option (but it is the easiest!). We are literally bundling everything in your project (including the massive node_modules folder) and uploading it to our Azure app service. Times will vary, but as a baseline, my deployment took roughly 6 minutes.
171171
12. Add `NODE_ENV` environment variable - In the App Service section of the explorer window, expand the newly created service, right click on **Application Settings**, select **Add New Settings...**, and add `NODE_ENV` as the key and `production` as the value.
172172
This setting determines which database to point to.
173-
If you haven't created a cloud database yet, see [the setup instructions](#mlab).
173+
If you haven't created a cloud database yet, see [the setup instructions](#Create a managed MongoDB with MongoLab).
174174
13. Profit! If everything worked you should see a page that looks like this: [TypeScript Node Starter Demo Site](https://typescript-node-starter.azurewebsites.net/)
175175

176176
### Troubleshooting failed deployments
177177
Deployment can fail for various reasons, if you get stuck with a page that says *Service Unavailable* or some other error, [open an issue](https://github.com/Microsoft/TypeScript-Node-Starter/issues/new) and I'll try to help you resolve the problems.
178178

179179
# TypeScript + Node
180180
In the next few sections I will call out everything that changes when adding TypeScript to an Express project.
181-
Note that all of this has already been setup for this project, but feel free to use this as a reference for converting other Node.js projects to TypeScript.
181+
Note that all of this has already been set up for this project, but feel free to use this as a reference for converting other Node.js projects to TypeScript.
182182

183183
## Getting TypeScript
184184
TypeScript itself is simple to add to any project with `npm`.
@@ -202,7 +202,7 @@ The full folder structure of this app is explained below:
202202
| Name | Description |
203203
| ------------------------ | --------------------------------------------------------------------------------------------- |
204204
| **.vscode** | Contains VS Code specific settings |
205-
| **.github** | Contains GitHub settings and configurations, incuding the GitHub Actions workflows |
205+
| **.github** | Contains GitHub settings and configurations, including the GitHub Actions workflows |
206206
| **dist** | Contains the distributable (or output) from your TypeScript build. This is the code you ship |
207207
| **node_modules** | Contains all your npm dependencies |
208208
| **src** | Contains your source code that will be compiled to the dist dir |
@@ -309,7 +309,7 @@ Below is a list of all the scripts this template has available:
309309
## Type Definition (`.d.ts`) Files
310310
TypeScript uses `.d.ts` files to provide types for JavaScript libraries that were not written in TypeScript.
311311
This is great because once you have a `.d.ts` file, TypeScript can type check that library and provide you better help in your editor.
312-
The TypeScript community actively shares all of the most up-to-date `.d.ts` files for popular libraries on a GitHub repository called [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types).
312+
The TypeScript community actively shares all the most up-to-date `.d.ts` files for popular libraries on a GitHub repository called [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types).
313313
Making sure that your `.d.ts` files are setup correctly is super important because once they're in place, you get an incredible amount of high quality type checking (and thus bug catching, IntelliSense, and other editor tools) for free.
314314

315315
> **Note!** Because we're using `"noImplicitAny": true`, we are required to have a `.d.ts` file for **every** library we use. While you could set `noImplicitAny` to `false` to silence errors about missing `.d.ts` files, it is a best practice to have a `.d.ts` file for every library. (Even if the `.d.ts` file is [basically empty!](#writing-a-dts-file))
@@ -373,7 +373,7 @@ If you're not interested, [you should tell me why](https://www.surveymonkey.com/
373373
### Summary of `.d.ts` management
374374
In general if you stick to the following steps you should have minimal `.d.ts` issues;
375375
1. After installing any npm package as a dependency or dev dependency, immediately try to install the `.d.ts` file via `@types`.
376-
2. If the library has a `.d.ts` file on DefinitelyTyped, the install will succeed and you are done.
376+
2. If the library has a `.d.ts` file on DefinitelyTyped, the installation will succeed, and you are done.
377377
If the install fails because the package doesn't exist, continue to step 3.
378378
3. Make sure you project is [configured for supplying your own `d.ts` files](#setting-up-typescript-to-look-for-dts-files-in-another-folder)
379379
4. Try to [generate a `.d.ts` file with dts-gen](#using-dts-gen).
@@ -384,8 +384,8 @@ If not, continue to step 5.
384384
```ts
385385
declare module "<some-library>";
386386
```
387-
7. At this point everything should compile with no errors and you can either improve the types in the `.d.ts` file by following this [guide on authoring `.d.ts` files](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html) or continue with no types.
388-
8. If you are still having issues, let me know by sending me an email or pinging me on twitter, I will help you.
387+
7. At this point everything should compile with no errors, and you can either improve the types in the `.d.ts` file by following this [guide on authoring `.d.ts` files](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html) or continue with no types.
388+
8. If you are still having issues, let me know by emailing me or pinging me on twitter, I will help you.
389389

390390
## Debugging
391391
Debugging TypeScript is exactly like debugging JavaScript with one caveat, you need source maps.
@@ -414,7 +414,7 @@ Because we are writing Node.js code, we don't have to worry about this.
414414

415415
### Using the debugger in VS Code
416416
Debugging is one of the places where VS Code really shines over other editors.
417-
Node.js debugging in VS Code is easy to setup and even easier to use.
417+
Node.js debugging in VS Code is easy to set up and even easier to use.
418418
This project comes pre-configured with everything you need to get started.
419419

420420
When you hit `F5` in VS Code, it looks for a top level `.vscode` folder with a `launch.json` file.
@@ -611,4 +611,4 @@ A majority of this quick start's content was inspired or adapted from Sahat's ex
611611

612612
## License
613613
Copyright (c) Microsoft Corporation. All rights reserved.
614-
Licensed under the [MIT](LICENSE.txt) License.
614+
Licensed under the [MIT](LICENSE) License.

0 commit comments

Comments
 (0)