faster-auto
Version:
A fast and lightweight framework for building RESTful APIs with Sequelize and Node.js. Supports automatic model loading, flexible query APIs, and built-in Swagger documentation.
29 lines (26 loc) • 656 B
text/typescript
import { Request, Response } from 'express';
import path from 'path';
import { Faster } from '../src';
const app = Faster({
modelDir: path.join(__dirname, 'models'),
db: {
dialect: 'postgres',
host: 'localhost',
port: 5432,
username: 'postgres',
password: '123456',
database: 'test'
},
swagger: true,
redoc: true,
logStartupInfo: true,
apiPrefix:'/api',
tablePrefix: 'tb_faster_auto_'
});
app.listen(3000, () => {
// console.log('http://localhost:3000');
});
app.get('/hello', (req: Request, res: Response) => {
res.send('Hello Faster Auto!');
});
// Models.User.findAll().then((user) => {console.log(user)});