This code sets up an Express.js app with minimal TypeScript support.
- Download the code as a
.zip
archive. - Extract the archive's contents into a new folder named, for example,
myapp
. (This is the name currently specified inpackage.json
.) - In
package.json
and inbin/www
(which is actually a JavaScript file), replacemyapp
with the name of your application folder. - Create a new file named
.env
in the root folder with the following initial content:# Replace myapp with the name of your application DEBUG=myapp:*
- Run
npm install
in the root folder.
npm start
compiles your .ts
sources and invokes nodemon
on the generated .js
files.
π¦
ββ .env # definitions of environment variables. Excluded from Git repo.
ββ .gitignore
ββ bin
β ββ www # startup code
ββ package-lock.json
ββ package.json # npm package configuration
ββ public # static assets
β ββ index.html
β ββ stylesheets
β ββ style.css
ββ src # TypeScript source tree root
β ββ app.ts # main application file
β ββ routes # Express routers. The folder hierarchy should reflect the hierarchy of your REST API endpoints.
β ββ index.ts
β ββ users.ts
ββ tsconfig.json # TypeScript configuration
ββ views # Jade templates. Remove this folder and all references to it in `app.ts` if you intend to use a frontend framework like React.
ββ error.jade
ββ index.jade
ββ layout.jade
Β©generated by Project Tree Generator