Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test.js:27
- export async function vList() {
- ^^^^^^
- SyntaxError: Unexpected token export
- const sql = require('mssql');
- const config = {
- user: 'sa',
- password: 'pwd',
- server: '192.168.10.24',
- database: 'vmaint'
- };
- let aList;
- async function getList() {
- try {
- let pool = await sql.connect(config);
- let result = await pool
- .request()
- .query('SELECT item1, item2, item3, item4 FROM items');
- aList = result.recordset;
- console.dir(aList);
- pool.close();
- } catch (err) {
- console.log(err);
- }
- }
- export async function vList() {
- if (!aList) {
- await getList();
- }
- if (!aList) {
- throw new Error('Could not get items');
- }
- return aList;
- }
- // getList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement