Description | Requirements | Technologies | Endpoints | Usage
Template made in Typescript with Express and structured with an architecture based on clean and ddd, to facilitate the creation of new projects and developer productivity, which can be created from this one.
Already configured with Typescript, ESLint, Prettier, Nodemon and Mongoose, with a pre-built CRUD and fully documented markdown architecture.
- NodeJs
- Typescript
- Express
- Nodemon
- Mongoose
- Husky
- Lint staged
- Pretty quicky
- Eslint
- Airbnb-config with another pessoal rules
- Import helpers plugin
- Prettier
- Commitlint
- Commitizen
Base url: https://localhost:5000/api/v1
You can use this project as a template for another one, or clone it on your pc using the command:
git clone https://github.com/Lissone/simple-node-api-template.git
cd simple-node-api-template
Install dependencies using:
yarn
#or
npm install
Enable husky git hooks:
yarn husky install
#or
npx husky install
You must create the database before running an api (dataBase).
// .\src\external\database\dbConfig.ts
const DB_URI = process.env.DB_URI || 'mongodb://localhost'
const connection = mongoose.connect(DB_URI, {
dbName: process.env.DB_NAME,
// user: process.env.DB_USERNAME,
// pass: process.env.DB_PASSWORD,
useFindAndModify: true,
useCreateIndex: true,
useNewUrlParser: true,
useUnifiedTopology: true
})
Need to add environment variables:
# .\.env
# DEFAULT
PORT=5000
# DATABASE
DB_USERNAME=sa
DB_PASSWORD=123456
DB_NAME=dataBase
DB_URI=mongodb://localhost
Run api:
yarn dev
#or
npm run dev
Distributed under the MIT License. See LICENSE
for more information.