Skip to content

hst-Sunday/express-api-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-api-demo

express+mysql 搭的一个api服务

用法

npm i
node ./bin/www

浏览器打开(确保数据库已连接,有数据):

localhost:3000/test

文档生成:

apidoc -i ./routes -o ./public

访问文档:

http://localhost:3000/apiDoc

MYSQL语句:

REATE TABLE IF NOT EXISTS `task` (
 `Id` varchar(50) NOT NULL,
 `Title` varchar(500) DEFAULT NULL,
 `Status` varchar(100) DEFAULT NULL,
 PRIMARY KEY (`Id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- Dumping data for table `task`
 --
 
INSERT INTO `task` (`Id`, `Title`, `Status`) VALUES
 ('1', 'Go to Market tomorrow', 'done'),
 ('2', 'Email to manager', 'pending'),
 ('3', 'Push code to GitHub', 'done'),
 ('4', 'Go For Running', 'done'),
 ('5', 'Go to Movie', 'pending');

参考资料

About

express-mysql-api-demo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published